Oct-24-2017, 01:41 PM
(This post was last modified: Oct-24-2017, 01:53 PM by sparkz_alot.)
Okay here is my code
import random
number = random.randint(1000,9999)
print number
count_attempts = 0
answer_status = "incorrect"
while(answer_status == "incorrect"):
guess = input ("please guess number")
count_attempts = count_attempts + 1
if guess == number:
print ("well done. The number of attempts it took were")
print count_attempts
answer_status = "correct"
else:
print("number of digits correct")
I need to insert a function which allow me to say when I get the answer wrong it will print the number of digits from the number that i guessed were right. Any ideas?
import random
number = random.randint(1000,9999)
print number
count_attempts = 0
answer_status = "incorrect"
while(answer_status == "incorrect"):
guess = input ("please guess number")
count_attempts = count_attempts + 1
if guess == number:
print ("well done. The number of attempts it took were")
print count_attempts
answer_status = "correct"
else:
print("number of digits correct")
I need to insert a function which allow me to say when I get the answer wrong it will print the number of digits from the number that i guessed were right. Any ideas?