So I'm just trying to learn programming/coding. and I'm trying to make a loop where the computer guesses at random a number that I put in (the variable), I mostly the loop with the "while" and "if/else" loops down but like...idk how to put the variable in. I'm sure there are other things wrong with the code. Its just a simple one since I actually just started 2 days ago. here is the code
input = var
x = 0
counter = 0
while x == 0:
from random import *
print randint(1, 3)
if randint == var:
x = 1
count = counter + 1
print (counter)
print "Good Bye!"
else:
x == 0
counter = counter + 1
print (counter)
Aucun commentaire:
Enregistrer un commentaire