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]
2 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]2 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
Sometimes we write similar letters to different people. For example, you might write to your parents to tell them about your cla
OleMash [197]

?

?????????????????????

4 0
3 years ago
Two system administrators who work in two different buildings for the same company want to open a communication channel between
xz_007 [3.2K]

Bridge communication is the best solution to continue two different building for the same company.

<u>Explanation:</u>

Bridge communication to be placed in both building.master device should be placed in one building where should be connected to a high-end server and the slave device should be placed in another device.

Both the master device and salve should have a subsequent TCPIP address. For example, if the master  TCPIP address is 192.168.1.51 and the salve Tcpip address should be 192.168.1.52.

Very easy configure and communication is established. Both devices should be connected with nonstop current interruption. Once communication established speed depends on device capacity.

8 0
3 years ago
Do you know how to change your grades on a printer???????????
BabaBlast [244]

Answer:

To change ur grade make sure to do it on the website first by right clicking your mouse and clicking inspect element and once done changing x out and it will save

Explanation:

5 0
3 years ago
When storing used oil, it needs to be kept in ___________ containers.
tester [92]

Answer:

Plastic container

Explanation:

because if we use iron it may rust and oil may also damage

5 0
3 years ago
Green computing involves reducing electricity consumed and environmental waste generated when using a computer. which of the fol
sergeinik [125]
If you want to support green computing, the most basic thing you can do is reduce your brightness. More light equals more energy consumption. That's why there are websites that are made as exact copies of other websites except they're entirely black because the color black spends less energy. You can also try to fix your things when they get broken instead of throwing them away instantly and buying a new one.
8 0
3 years ago
Other questions:
  • In hunter-gather societies most hunting was done by
    9·2 answers
  • Book checkout scenario at a library: The Worker tells the System the identity of a patron who wishes to check out books. The Sys
    8·1 answer
  • Anyone wanna play among us UwU code is TAEQPQ
    15·2 answers
  • The type of e-cards that have an antenna built into them are __________ cards.
    10·2 answers
  • User defined blocks of code can be created in
    13·1 answer
  • The sun can be an excellent source of natural light.<br> True.<br> False.
    8·2 answers
  • What is the<br>Way to<br>keep the tool<br>Screw​
    6·1 answer
  • 2. The<br>is the main and usually largest data storage hardware device in a computer​
    9·1 answer
  • What are some innovations that television has undergone since its original invention ?
    11·1 answer
  • A(n) ________ address is the address that external entities use when communicating with your network.
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!