Page 124 - Information_Practice_Fliipbook_Class11
P. 124
17 grade = 'A'
18 elif percentage >= cutOffB:
19 grade = 'B'
20 elif percentage >= cutOffC:
21 grade = 'C'
22 elif percentage >= cutOffD:
23 grade = 'D'
24 else:
25 grade = 'F'
26
27 print('Your grade is', grade)
InlShtltxnepatlgivtnlnbovtliflShtlpercentage itl54,lboShloflShtlconditonnaltxprtttiontlpercentage >= cutOffA,
nnd percentage >= cutOffB yitadtl(onltvnaunton) False,lbuSlShtlconditonnaltxprtttion percentage >=
cutOffC yitadtl(onltvnaunton) True, to ShtltSnStetnS:
grade = 'C'
itltxtcuStd.lFinnaay,lonlShtltxtcutonloflShtltSnStetnS:l
print('Your grade is', grade)
PyShonlinStrprtStrlouSpuStlShtletttngt:l
Your grade is C
>>> Enter student's percentage: 54
Your grade is C
Program 5.7 WriStlnlprogrnelShnSlchtcktlwhtShtrlnlnuebtrlitlpotitvt,lntgntvt,lorlztro,lnndlditpanytlnnlnpproprinStl
etttngt.
Solution:
01 #Objective: To check whether a number is positive, negative or zero
02 num = int(input("Enter a number : "))
03 if num > 0:
04 print("POSITIVE")
05 elif num < 0:
06 print("NEGATIVE")
07 else:
08 print("Number is ZERO")
nepatlOuSpuSl1:
>>> Enter a number : 4
POSITIVE
nepatlOuSpuSl2:
>>> Enter a number : -2
NEGATIVE
nepatlOuSpuSl3:
>>> Enter a number : 0
Number is ZERO
Program 5.8 WriStlnlprogrnelShnSlncctpStlntlinpuSlnlbinnryloptrnSorlnndlSwoloptrnndtlnndlcoepuSttlShtlrttuaSlofl
nppayinglSht optrnSor.lThtlprogrneletrtaylchtcktliflShtlgivtnloptrnSorlenSchttlnnyloflShtloptrnSortlwiShinlShtlttSl
{+, -, *, /, %, //, **},lnndlprinSlShtlrttuaSloflnppayinglShtloptrnSorlSolShtloptrnndt.
Solution:
01 '''
02 Objective: To evaluate an integer expression with two operands
03 Approach: 1. To accept the operator and the operands from a user
04 2. To evaluate the expression
05 Inputs:
110 Touchpad Informatics Practices-XI

