dimanche 29 janvier 2017

python multiples of 19

I have been working on this for a few days now. I have looked at several tutorials and read in my book, I am very new to coding.

I am required to write this program

This program should prompt the user to enter an exact multiple of 19 that is greater than 200. Then, the program should analyze the input and display a response to each of the four possible results of the analysis. See sample runs below.

Enter an exact multiple of 19 that is greater than 200 76 No, 76 is a multiple of 19 but it is not greater than 200

Enter an exact multiple of 19 that is greater than 200 55 55 is not over 200 and also is not a multiple of 19

Enter an exact multiple of 19 that is greater than 200 222 222 is over 200 but is not a multiple of 19

Enter an exact multiple of 19 that is greater than 200 380 Good input. 19 divides into 380 exactly 20 times

this is what I have so far

#promt user to enter an exact multiple of 19 that is larger than 200
#assign variable a to user input
def main () :
    random = int(input('Enter an exact multiple of 19 that is greater than 200:'))

    number = random / 19


    if random > 200 :
        print('Good input 19 divides into', random , 'exactly' , number ,'times')


    if random % 19 == 0 or random <200:
        print('is a multiple of 19')

    else:
        print('is not a multiple of') 


main () 

i can get the program to spit out the line for the user inputting 380 but I am at a loss as far as how to write up the other outputs. Help would be awesome!!!

Aucun commentaire:

Enregistrer un commentaire