lundi 30 mars 2015

Need help to write a compare function


Vote count:

0




need help to wirte the compare part of this program as a function


import random import sys


def myScript():



ett = random.randint (1, 100)
tva = random.randint (1, 100)

print ("tal1", ett, "\n""tal2", tva)

if (ett > tva):
print ("tal1 är störst")

elif (tva > ett):
print ("tal2 är störst")

else:
print("talen är lika stora")



print ("vill du testa igen y/n")
yes = set(['y'])
no = set(['n'])

choice = input().lower()
if choice in yes:
myScript()
elif choice in no:
sys.exit()
else:
sys.stdout.write("Please respond with 'y' or 'n'")
myScript()


myScript()



asked 1 min ago







Need help to write a compare function

Aucun commentaire:

Enregistrer un commentaire