I learned python for about a week. I wrote a game that guessed numbers !, Python guess number
Print ("-------------------------------------------------------")
Print ("-------------------------------------------------------")
Print ("-------------- this is a game that guesses numbers from each other -----------------")
Print (''' is up to you to guess. This is a number between 1 and!
Now the computer has determined a number. What do you guess! ''')
Luckynumber = 67
Ln = int (input ("Enter the number you guessed :"))
While not ln = luckynumber:
If ln <luckynumber:
Print ("the number you entered is smaller than my number! ")
Else:
Print ("the number you entered is larger than my number! ")
Ln = int (input ("Please input again :"))
Print ("You guessed it! Is ", ln)
Print ("---------------------------------------------------------")
Print ("---------------------------------------------------------")
Print ("now it's the computer's time to guess. Please set a number between 0 and in your mind ")
Print ("if I guess the number is larger than your number, enter B. If it is smaller than your number, enter s. If it is equal, enter e! ")
Print ("are you sure you want to know, computer started to guess! Press any key to start ")
Ln = range (1, 101)
While not len (ln) = 1:
Luckynumber = ln [len (ln) // 2]
Answer = input ("is" + str (luckynumber) +? Please answer :")
If answer = "B ":
Lista = len (ln) // 2
Ln = ln [: lista]
Elif answer = "s ":
Listb = len (ln) // 2
Ln = ln [listb:]
Elif answer = "e ":
Break
Else:
Print ("Enter three answers: B, s, and e! ")
# Nb = 0
# Sodium = 100
# Ln = nb + (na-nb) // 2
# Answer = ln
# While not answer = "e ":
# Ln = nb + (na-nb) // 2
# If answer = "B ":
# Na = ln
# Elif answer = "s ":
# Nb = ln
# Else:
# Print ("Enter B, s, and e answers! ")
# Answer = input ("is" + str (ln) +? Please answer :")
Print ("I guess it is", luckynumber)
# s=""
# for i in range(101):
# s=s+str(i)+" "
#Print (s)
# There are two solutions: Numbers and lists. The comment contains the number scheme.