mardi 17 avril 2018

I’m creating a "guessing number" game in python. However python doesn't print out "correct answer", when the answer is right. Can someone help please?

For some reason "correct answer" is not being printed even when i get the answer right. I am not sure why. Can anyone help please?

import random
y = random.randint(1,6)

start_game = input("Pick a number between 1 and 6")


while start_game != y:
  if start_game  > y:
    print("guess too high")
    start_game = input("Pick a number between 1 and 6")
  elif start_game < y:
    print("guess too Low")
    start_game = input("Pick a number between 1 and 6")
  else:
    print("correct guess")`

Aucun commentaire:

Enregistrer un commentaire