subject

Warm up: simplify fraction (python 3) overview: we ask the user for the numerator and denominator of a fraction and compute its simplified form. ask the user for a fraction. the fraction should have the format integer/integer. you will need to parse the input on the forward slash to find the numerator and denominator. computer the gcd divide both by the gcd and print out the new fraction the greatest commorn demoninator of two integers is easy to implement recursively. you will not receive credit if your solution is not recursive. if the denominator is 1, then only print the numerator. do not print 5/1, just print 5. the gcd function must have the format def gcd(a, b). the goda,0)=a for any integer a. for all other values in the second input, gcd(ab)-gcd(b, a % b) ask for fractions and simplify them until the user enters 'exit' as their fraction. remember to include if name_main_" so zybooks can include your functions for testing example welcome to fraction simplifier type "exit" to quit enter fraction (int/int): 125/55 simplified fraction enter fraction (int/int): 8/2 simplified fraction enter fraction (int/int): 27/9 simplified fraction enter fraction (int/int): 76/92 simplified fraction 19/23 enter fraction (int/int): exit bye

ansver
Answers: 3

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 00:30, bargasdevon123
To insert a column without using commands in any tabs, a user can -click and then click insert column.
Answers: 3
image
Computers and Technology, 22.06.2019 19:50, rosyposy43
Write a car class having two private member variables called tank and speed. write public methods called pumpgas and gofast. the method pumpgas gets an integer for gas that must be pumped. that value needs to be added to tank (no more than 20 gallons). it must return the amount of gas that is purchased ($4 per gallon). the method gofast should increase the speed by 5 each time it is called. write a constructor for the above class that initialized both variables to zero. write a tostring to display both the tank and speed when the car is printed. modify the car class to implement the interface comparable and an interface called carinter having the public methods in carinter. write the main program to create an array of size 5 of type car. create 5 car objects having each location of the array to refer to one of the cars. test the pumpgas, gofast, equals method on the array items. write an enhanced loop to print all the car values (using a tostring written last time).write a generic method to find the minimum of four items. pass int, double, char, string and car objects to test this method.
Answers: 1
image
Computers and Technology, 24.06.2019 11:20, isabelperez063
Every telecommunication setup uses two devices: one device to transmit data and one device to receive data. which device transmits frequencies to mobile phones? towers transmit frequencies to mobile phones.
Answers: 1
image
Computers and Technology, 24.06.2019 12:40, kanga06
Match the feature to the network architecture. expensive to set up useful for a small organization easy to track files has a central server inexpensive to set up difficult to track files useful for a large organization does not have a central server client- server network peer-to-peer network
Answers: 3
You know the right answer?
Warm up: simplify fraction (python 3) overview: we ask the user for the numerator and denominator...

Questions in other subjects:

Konu
Social Studies, 17.05.2021 22:00