Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import random #import random library
- dl= input('Enter Difficulty Level for guess the number game!:\n E for easy, M for medium, H for Hard, B for Blindfold Hard mode(No hints)') #Selects Difficulty level
- if dl=='E' or dl== 'e':
- maxn = 10
- n = random.randint(1, maxn)
- print('Welcome to guess the number game: Easy mode!')
- print('Guess the number from 1 to %d' % maxn)
- guess = None
- while guess != n:
- guess = int(input('Your try: '))
- if guess > n:
- print('Too high')
- if guess < n:
- print('Too low')
- if guess==n:
- print('Congratulations, You won!')
- elif dl=='M' or dl== 'm':
- maxn = 50
- n = random.randint(1, maxn)
- print('Welcome to guess the number game: Medium mode!')
- print('Guess the number from 1 to %d' % maxn)
- guess = None
- while guess != n:
- guess = int(input('Your try: '))
- if guess > n:
- print('Too high')
- if guess < n:
- print('Too low')
- if guess==n:
- print('Congratulations, You won!')
- elif dl == 'H' or dl== 'h':
- maxn = 100
- n = random.randint(1, maxn)
- print('Welcome to guess the number game: Hard mode!')
- print('Guess the number from 1 to %d' % maxn)
- guess = None
- while guess != n:
- guess = int(input('Your try: '))
- if guess > n:
- print('Too high')
- if guess < n:
- print('Too low')
- if guess==n:
- print('Congratulations, You won!')
- elif dl=='B':
- maxn = 100
- n = random.randint(1, maxn)
- print('Welcome to guess the number game: Blindfold Hard mode!')
- print('Guess the number from 1 to %d' % maxn)
- guess = None
- while guess != n:
- guess = int(input('Your try: '))
- if guess==n:
- print('Congratulations, You won!')
- else:
- print('Please enter a valid letter for difficulty level')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement