Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

QUESTION IS IN PYTHON. PEASE ANSWER IN PYTHON Enter and execute the following program 1 def main (): lastName - input (Enter last name firstName

QUESTION IS IN PYTHON. PEASE ANSWER IN PYTHON image text in transcribedimage text in transcribed

Enter and execute the following program 1 def main (): lastName - input ("Enter last name" firstName -input ("Enter first name ") studentID -input ("Enter ID ") inFile open ("studentInfo.txt", "a") inFile.write ("Name: "+ firstName + " " + lastName) inFile. write (" StudentID: " studentID) inFile. write (" ") inFile. close () print ("Done Data is saved in file: studentInfo.txt") 6 10 12 13 Ht Call to main 14 main() (a) (4 points) Which lines print to the screen? (b) (2 points) What does the program do? (c) (2 points) Locate the file studentInfo.txt on your computer. The file is stored in the same folder as the program. What is stored in the file? (d) (2 points) Run the program again. How did the studentInfo.txt file change? (e) (2 points) Change the argument "a" to "" in the call to the open function. Run the program a third time Explain what "a" to "w" do (f) (2 points) Did you need create the file studentInfo.txt separately from the program code or did the program create it? (g) (2 points) Notice the function write). How many arguments does this function have? (h) (2 points) How does the write) function know what file to write to? (i) (2 points) what line of code closes the file? (i) (2 points) Where is the line of the code that closes the file positioned in the program? (k) (5 points) Write a program that prompts the user for information for three students: name, student ID, number of credits earned. Store the information in a file. You can use the above code as a template for your solution Describe how you revised the code to solve this

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Driven Web Sites

Authors: Joline Morrison, Mike Morrison

2nd Edition

? 061906448X, 978-0619064488

More Books

Students also viewed these Databases questions