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
Using the POP standard for client to server e-mail communication, the e-mail messages remain on the server computer. True False
Gelneren [198K]

Answer:

False

Explanation:

8 0
3 years ago
King(a. has eaten b.ate c.had eaten) when Airah called​
Alenkinab [10]

Answer:

c

Explanation:

king had eaten when Airah called

3 0
3 years ago
What isthe concept of packets, give example?
Oduvanchick [21]

Answer: Packets are the small unit of data that is sent from source to destination on a network.

Explanation: Packets are small packages that carry data in a packet form and is used from transferring it on internet or any kind of packet-switched network. They use the internet protocol (IP) for the transmission of data.

Example: packet radio is a sort of digital radio that uses the packet for transmission of data to other nodes by utilizing the AX-25 protocol.

6 0
3 years ago
What is the largest value you can represent using 256 bit signed integer?
Katen [24]
<span>1.1579208923731619542357098500869e+77</span>
8 0
4 years ago
Complete each sentence by choosing the correct answer from the drop-down menus.
dusya [7]

Answer:

the printer works by spraying ink onto paper. Ink-Jet printers

use a laser beam and static electricity to transfer words and images to paper.  Laser printers

are primarily business printers because they produce high-quality printed material and are expensive to purchase. Laser Printers

Laser printers use a special powdered ink called toner

6 0
2 years ago
Other questions:
  • Write an algorithm whether the given number is positive negative or zero​
    5·1 answer
  • What is the name of the malware included in CCleaner?
    13·1 answer
  • The design of computers, devices, and media in a network is categorized as either client/server or peer-to-peer. what is the ter
    8·1 answer
  • The first computer was developed by the government to spy on communist activities. Please select the best answer from the choice
    13·1 answer
  • Defeating authentication follows the method–opportunity–motive paradigm.
    5·1 answer
  • What is the smallest negative integer that can be represented in two's complement system in which each value is represented by e
    7·1 answer
  • Explain basic anatomy of computers.
    13·2 answers
  • 2 red and 2 overlapping balls in the center are surrounded by a green, fuzzy, circular cloud with a white line running through i
    15·2 answers
  • Consider the following code segment:
    12·1 answer
  • onsider a file system on a disk that has both logical and physical block sizes of 512 bytes. assume that the information about e
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!