Question: Please write a code for Python3 Write code for function main, which does the following: 1. get one integer value from the user. 2. using

Please write a code for Python3  Please write a code for Python3 Write code for function main,

Write code for function main, which does the following: 1. get one integer value from the user. 2. using a loop that runs as long as a variable named stop is not 0. The loop gets integers from the user and add those to a list named factors as long! as the user does not enter 0. If the input is O do not ad it to the list and assign variable stop to 0. 3. If the result of passing the input of step 1 and the list of step 2, to function factors is a true value, write all the numbers in the list, each on its own line to a file. Ask the user for the filename. 4. If step 3 results in a false value, print the message "numbers are not factors". 5. Add exception handling to the code above (think of where to place it) so that any error from writing the data to the file are handled by printing the message "data writing failed", otherwise print "data writing succeeded" Call main at the end

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!