You are on page 1of 2

• Programming implementation :

– 1)Generate a random integer, ranging from 1 to 100;if the random integer is 13,
the output is “Your score is: 13”
– 2)If the integer is less than 60 ,output is “This exam is failed”;
if the integer is less than 75 and which is greater than or equal to 60, the output
is "This exam is passed";
if the number is less than 85 and which is greater than or equal to 75, the output
is "You are good";
if the number is less than or equal to 100 and which is greater than or equal to 85,
the output is "You are excellent"
Answer:

import random

value = random.randint(1, 100)


print(value)

if value == 13:
print("your score is: " + value)
elif value < 60:
print("This exam is failed")
elif (value < 75) & (value >= 60):
print("This exam is passed")
elif (value < 85) & (value >= 75):
print("You are good")
elif (value <= 100) & (value >= 85):
print("You are excellent")
Screenshot:

You might also like