Question
Python 3.6 The user has an option to either input 2 numbers or read from a txt file.The objective is to get the greatest common
Python 3.6
The user has an option to either input 2 numbers or read from a txt file.The objective is to get the greatest common divisor. When doing txt file,I have to read each line of "GCD.txt" - and there are 2 numbers on each line. After reading the 2 numbers on each line, I must get the GCD. If the user inputs 2 numbers onto the keyboard, then I have to directly output the GCD. Please make the necessary changes to my source code. I'm using Mac OS , so reading files can be different from Windows. Please provide corrected indented source code and screenshot of output for full credit.Thanks. Below is the following necessary information:
if b a: while b l= 0: 10 a=t return a 12 13 14 15 16 17 def read file() myfile = open ("GCD.txt'') mytxt-myfile.read() myfile.close( 19 20 21 print("Option 1: Read from a filel ") print("Option 2: Input information onto the keyboard ") k = (input ("What would you like to do?")) if k == 1: 23 24 25 26 27 28 print(input("What is your 2 numbers that you would like to find the Greatest Common Divisor for? )) elif k =-2: print(input ("What is the file's name?") )Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started