这是我的代码
import random
import os
import time
def Num_guess():
rand_num = (random.randint(0,9))
print("Welcome to guess the number. ")
guess_num = int(input("What number am i thinking of. "))
if guess_num == rand_num:
print("correct! ")
time.sleep(1.5)
os.system("cls")
Num_guess()
elif guess_num > 10:
print("invalid. 0-9 only")
time.sleep(1.5)
os.system("cls")
Num_guess()
elif guess_num < 0:
print("invalid. 0-9 only")
time.sleep(1.5)
os.system("cls")
Num_guess()
elif guess_num != rand_num:
print("Nope not corrrect. The number was ")
print(rand_num)
time.sleep(1.5)
os.system("cls")
Num_guess()
Num_guess()