Lab Assignment 4 Imp
Lab Assignment 4 Imp
Applications of ICT
(Information and Communication Technologies)
Instructor: Mr. Mohsin Ahmed
PYTHON CODE:
print('\nWelcome to the guessing game')
print('You have unlimited chances to guess the number between 1 and 100')
import random
number = random.randint(1,100)
while True:
guess = int(input('Enter your guess: '))
if guess == number:
print('You guessed it right')
print("congratulations")
break
else:
print('Try again')
#Hint
if guess < number:
print('The number is greater than', guess)
else:
print('The number is less than', guess)
print('The number was', number)
print('Game over')