1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Licemer1 [7]
3 years ago
6

The create_python_script function creates a new python script in the current working directory, adds the line of comments to it

declared by the 'comments' variable, and returns the size of the new file. Fill in the gaps to create a script called "program.py". 1- def create_python_script(filename): 2 comments = "# Start of a new Python program" with open("filename", "w+") as file: file.write(comments) import os filesize - os.path.getsize(filename) print("The size of the file is:") return(filesize) Reset 3 4 5 6 7 Run 9 10 11 print(create python script("progran.py"))
Computers and Technology
1 answer:
Vika [28.1K]3 years ago
6 0

Answer:

import os

def create_python_script(filename):

   comments = "# new python script file"

   with open(filename,"w+") as file:

       file.write(comments)

   filesize = os.path.getsize(filename)

   print(f"The size of the file is: {filesize}")

create_python_script("program.py")

Explanation:

The os module is a built-in python file that is used to interact with the operating system terminal. The with keyword is used to create and open a file with write privileges with no need to close the file.

The path.getsize() method is used to get the size of the newly created file which is printed in the console.

You might be interested in
Taday is the anniversary of September 11, 2001. you were to meet the child of a victim or survivor of 9/11, what would you say t
Vlad1618 [11]

Answer:

Hi How's you day

Explanation:

7 0
4 years ago
The type code for an int array is 'b'. What line of code creates an array of int data values?
Ilia_Sergeevich [38]

Answer:

intArray=array(’b’,[2,5,10])

Explanation:on edge

8 0
3 years ago
a colleague shared an excel file with you, and you want to display a worksheet that is hidden in it. how can you do that?
Sonja [21]

The hidden worksheet can be made visible with the right click on any worksheet and select unhide.

<h3>What is a worksheet?</h3>

A worksheet in Microsoft Excel is the collection of the rows and column that has been used to organize data. The collection of worksheets is called workbook.

The hidden worksheets are not visible in the workbook, and if an individual wants to unhide the hidden worksheet, he must right-click on any worksheet and select unhide.

Learn more about worksheet, here:

brainly.com/question/1024247

#SPJ1

4 0
2 years ago
What do you mean by flow of program​
Ahat [919]
The flow program now called Power Automate, is cloud-based software that allows employees to create and automate workflows and tasks across multiple applications and services without help from developers. I think Thts what you meant
7 0
3 years ago
Which translator program reads small portions of a program at a time, translating them into machine instructions which are then
leva [86]

Answer:

Interpreter is the correct answer for the above question.

Explanation:

  • The interpreter is a software program which is an example of a translator and it does not take whole code at a time for conversion. It converts the code on a line by line sequence. It takes some small code and then converts it into machine code.
  • While the other translator takes the whole code at a time and converts it into machine code.
  • The above question wants to ask about that technology which is used to convert some small code not the whole code at a time then the answer is an interpreter which is defined as above.
3 0
3 years ago
Other questions:
  • Assume you're using a 3 button mouse. to access shortcut menus, you would
    6·2 answers
  • A university wants to install a client-server network. Which feature do you think is important for them as they set up the netwo
    8·1 answer
  • What stdio.h input function would be used to get input from the user by the keyboard? Write the code to obtain the voltage drop
    7·1 answer
  • The ability to keep web page visitors at your site is called _______.
    11·1 answer
  • Which statement accurately compares the Restart at 1 and Continue Numbering features of Word?
    13·2 answers
  • Which item is essential to know before sketching a navigation menu flowchart? template specifics, such as horizontal or vertical
    12·1 answer
  • Active space is important in which type of photograph?
    12·2 answers
  • Write a SELECT statement that returns the same result set as this SELECT statement. Substitute a subquery in a WHERE clause for
    13·1 answer
  • Which type of malware prevents you from accessing files stored on your computer?
    10·2 answers
  • What happens if the new context is in memory rather than in a register set and all the register sets are in use?
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!