Programming Third Batch (Selection) 21-29
Programming Third Batch (Selection) 21-29
Third Batch
Selection with Boolean Operatores and Built-In Functions
Note: These tasks are to be solved in a programming language and in Pseudocode. Where instructed
give the output as given using concatenation operator of selected langauage and “&” for pseudocode.
TASK # 21: Input the marks obtained by a student in 2 test. Ouptut the grade
Task # 22: Input the Carbon Contents, tensile strength and hardness of a steel.
Hardness > 8
For testing, check it 8 times and each time a different grade should be printed.
It is called exhaustive testing when you make sure each possible route/path is
Use the built-in Function ord() to get the ascii code of a character
x = ord(ch)
Special numbers are the ones that are in the following ranges inclusive
20 - 30
50 - 60
80 - 90
All numbers input must be in the range 0 - to 100 and if not an error
must be displayed.
Task # 25: Input a character and print if it is a vowel or consonant. Make sure
the input is a character. Upper and lower case both are allowed, but nothing
else other than a character should be allowed. Give an error in case input
is not a character.
Task # 26: Generate a random number between 1 and 10 inclusive using the library random.
Ask the user to guess it, if the guess is exactly the number print "Bingo"
print "Close" otherwise print "You Loose". If the guess is wrong then print the
Task # 27: Input a 4 digit number and print if it is a palindrome or not. Palindrome
Task # 28: Input the marks obtained by a student in 2 test. Ouptut the grade
Task # 29 : Your program should generate a random number between 1 to 20. Now let the user
guess this number but only allow 3 tries. Your program must not use a loop( O Level Students).
Each time if the user guesses a number greater than the original one print
"Too High" or if is smaller print "Too Low!" otherwise if it is equal print "Bingo!"
If the user is done with 3 wrong attempts then print "You loose".