Days_18 Guess the Number

ariwirasaputra

Ari Wira Saputra

Posted on April 1, 2023

Days_18 Guess the Number

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.

  1. Start by picking a number between 0 and 1,000,000. This will be your first variable.
  2. Create a while loop to keep asking the user to guess your number.
  3. If they are too low, tell them "too low." If they guess too high tell, them "too high."
  4. 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()
Enter fullscreen mode Exit fullscreen mode
💖 💪 🙅 🚩
ariwirasaputra
Ari Wira Saputra

Posted on April 1, 2023

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related