We are going to build a "Guess the Number" guessing game.
You are going to use a while loop and some of the concepts from the past few days.
- Start by picking a number between 0 and 1,000,000. This will be your first variable.
- Create a while loop to keep asking the user to guess your number.
- If they are too low, tell them "too low." If they guess too high tell, them "too high."
- If the user guesses correctly, tell them they are a winner (maybe add a fun emoji too!) 5.Count the number of attempts it took for the user to guess number. Make sure you only show that after they get the answer correct.
# Let's Cheat Continue
#
#29 MARCH 2023
class challenge18():
def __init__(self, number, testing):
self.number = number
self.testing = testing
def methode(self):
self.number = 50
while self.testing in range(0, 100):
if self.testing > self.number:
print("angka sangat besar")
elif self.testing < self.number:
print("angka sangat kecil")
def call():
testing = challenge18(input("masukan angka"))
testing.methode()
call()
Top comments (0)