vendredi 22 septembre 2017

How do I make a randomly generated integer equal a manually entered one?

I've been working on a small project to help my coding, and have run into a simple problem, So I'm trying to recreate a small game calls 'odds on' as per where I live, where you and a friend say a number, let's say between 1 and 5, at the same time, and if your friend says the same number as you, you win, basically, and I've got my code working, mostly, however it only says that I lose, even if the computer answer is equal to my answer, have a look at the whole code:

oddsonplayer = input("")

print(oddsonplayer)

import random
oddsoncomputer = (random.randint(1,5))

if oddsonplayer > "5":
    print("Pick a number between 1 and 5!")
if oddsonplayer == oddsoncomputer:
    print("You Win!")
else:
print("You Lose!")

So long story short, it says I lose, even if both numbers are equal.




Aucun commentaire:

Enregistrer un commentaire