Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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:

image text in transcribed

image text in transcribed

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

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_2

Step: 3

blur-text-image_3

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

How Do I Use A Database Research Tools You Can Use

Authors: Laura La Bella

1st Edition

1622753763, 978-1622753765

More Books

Students also viewed these Databases questions

Question

x-3+1, x23 Let f(x) = -*+3, * Answered: 1 week ago

Answered: 1 week ago