Guess_The _Number | Programming_info || python_series_03

 Rules For the game:

1. change the number range from 1 to 1000000

2. Game should ask us to change a number

3.Give a clue of the number is higher or lower than the guess

 4. inform the player if he won 

Code using Python:

from random import randint

start = 1

end = 500

value = randint(start, end)

print("The computer choose the number between ", start, "and", end)

guess = None

while guess != value:

    text = input("Guess the number : ")

    guess = int(text)


    if guess < value:

        print("The number is higher")

    elif guess > value:

        print("The number is lower")


print("Congratulations !!! you guessed the number ! You won")


Output:

The computer choose the number between  1 and 500

Guess the number : 250

The number is higher

Guess the number : 375

The number is higher

Guess the number : 450

The number is lower

Guess the number : 400

The number is higher

Guess the number : 425

The number is lower

Guess the number : 410

The number is lower

Guess the number : 405

The number is lower

Guess the number : 402

The number is higher

Guess the number : 404

The number is lower

Congratulations !!! you guessed the number ! You won


Share:

1 comment:

  1. PokerStars Casino Review & Bonus Code - JTHub
    For example, in 원주 출장안마 most states, pokerStars Casino is licensed by the Gambling Commission 서귀포 출장마사지 to provide players 양산 출장안마 with the full 김천 출장마사지 range of 제천 출장안마 games and offers

    ReplyDelete

Translate

Recommended platforms

  1. codechef
  2. hackerrank
  3. codeforces
  4. leetcode
  5. hackerearth

Popular Posts

programming_info. Powered by Blogger.

Recent Posts

other platforms

  • geeks for geeks
  • w3schools
  • codepen
  • skillshare
  • udemy

Pages

reader support Support