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
djyliett [7]
3 years ago
9

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".
def create_python_script(filename):
comments = "# Start of a new Python program"
with ___:
filesize = ___
return(filesize)
print(create_python_script("program.py"))

Computers and Technology
1 answer:
iogann1982 [59]3 years ago
3 0

Answer:

Following are the code to this question:

with open(filename,"w+") as file: #use an open method that open file in w+ mode        

   file.write(comments)#use write method that inputs the value in the file            

   file.close()#closing the file  

import os#import package os for file  

filesize = os.path.getsize(filename)#defining a variable filesize that uses the getsize method to calculate its size.

Explanation:

Following are the full program to this question:

def create_python_script(filename):#defining method create_python_script that accept filename variable as the parameter

   comments = "# Start of a new Python program"#defining a string varaible comments that holds string value      

   with open(filename,"w+") as file: #use an open method that open file in w+ mode        

       file.write(comments)#use write method that inputs the value in the file        

       file.close()#closing the file    

   import os#import package os for file  

  filesize = os.path.getsize(filename)#defining a variable filesize that uses the getsize method to calculate its size.  

 return filesize#return filesize value

print(create_python_script("program.py"))#use print method that call create_python_script and print its return value

Output:

please find program file and its output.

Program description:

In the above-given program, a method "create_python_script" is declared that accept the "filename" as the parameter, inside the method a comments string variable is declared, that holds string value and define an open method to open "program.py" file and assign the string value in the file.

In the next line, the "getsize" method is defined, which counts string value in digits and returns its value and use the print method to call the "create_python_script" with parameter a print its value.

You might be interested in
This is the question
nikdorinn [45]

Answer:

I dont know it sorry

Explanation:

i would help u

4 0
3 years ago
Kim, a user, took a laptop on vacation and made changes to the configuration in order to use the device at the hotel. She can re
viktelen [127]

Answer:

d

Explanation:

its because you didn't reconfigure the ssid settings

4 0
3 years ago
you are using linux and need to perform a reverse lookup of the ip address 10.0.0.3. which command would you use to accomplish t
ollegr [7]

A command you would use to perform a reverse lookup of the IP address 10.0.0.3 on a Linux system: dig -x 10.0.0.3.

<h3>What is a Linux command?</h3>

A Linux command can be defined as a software program that is designed and developed to run on the command line, in order to enable an administrator (end user) of a Linux network perform both basic and advanced tasks by only entering a line of text.

<h3>What is IP address?</h3>

IP address is an abbreviation for Internet protocol address and it can be defined as a unique set of numbers that are assigned to a computer, website or other network devices, in order to successfully differentiate them from one another in an active network system.

In Computer Networking, a command which an administrator (end user) would use to perform a reverse lookup of the IP address 10.0.0.3 on a Linux system is dig -x 10.0.0.3.

Read more on Linux commands here: brainly.com/question/25480553

#SPJ1

3 0
2 years ago
Which group in the Timeline Tools contextual tab would help you alter the color of a timeline?
Doss [256]

Answer:

The answer is B: styles

Stay safe! <3

4 0
3 years ago
Read 2 more answers
I need help with this. It's while loops in python.
CaHeK987 [17]

Answer:

Here is a simple application running loop example in python

running = true

while(running):

# YOUR CODE HERE

Explanation:

A while loop is basically a loop of something if something is true

so if there is a boolean set to true for a application to run then use a while loop. Have a nice day! :)

4 0
3 years ago
Other questions:
  • If a filesystem has a block size of 4096 bytes, this means that a file comprised of only one byte will still use 4096 bytes of s
    12·1 answer
  • When employees are hired, they agree to only use cell phones during breaks. How would you classify this?
    8·2 answers
  • How to be good at photography?
    5·2 answers
  • Elizabeth has an assignment to complete. in her internet search, she got 5,006,321 hits. to narrow the search, she would convert
    11·2 answers
  • Which device makes telecommunications possible?
    9·1 answer
  • Four categories of installer apps
    13·1 answer
  • What is the benefit of making an archive folder visible in the Outlook folder list?
    6·1 answer
  • I'm having trouble with an assignment of mine. I'm making a text based adventure game for extra credit in my class and I'm stuck
    12·1 answer
  • Three primary types of data that a forensic investigator must collect, in this order: 1.Volatile data 2.Temporary data 3.Persist
    11·1 answer
  • Which of the following must be true for hydropower to work?
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!