Page 199 - Computer Science Class 11 With Functions
P. 199
perimeter = 4*Side
PRINT('The area is ', area)
Ans. side = int(input('Enter a number')) # Need to convert str to int
perimeter = 4*side # Identifiers are case sensitive
print('The perimeter is ' , perimeter) # no function by the name
#PRINT. Identifiers are case sensitive
6. Conoidernthenfollowingnfunctionnwhichngivenannexamplenofnanfunctionncalln(Statementn1)nfornthenfollowingnfunctionndefinition:n
def tourAmount(no_of_pax):
return no_of_pax * 1500
no_of_pax = int(input("Enter the number of passengers : "))
_________________________________ #Statement 1
print(amount)
Ans. amount=tourAmount(no_of_pax)
7. Whatnwillnbenthenoutputnofnthenfollowingnprogram?
def cal(x,y,z):
x+=10
y*=5
z-=2
print(x,y,z)
var1=-1
var2=20
var3=50
cal(var2,var3,var1)
Ans. 30 250 -3
8. Rewritenthenprogramngivennbelownafternremovingnthenerroro.nUnderlinenallnthencorrectiononmade.
def circle(radius)
area = 2 * 3.14 * radius
print("Area of circle is : " + area)
r=float("Enter the radius of the circle : ")
circle()
Ans. def circle(radius):
area= 3.14 * radius**2
print("Area of circle is : " , area)
r=float(input("Enter the radius of the circle : "))
circle(r)
9. Predictnthenoutputnofnthenfollowingncode,nifninputngivennion12.
def inputData():
inches=float(input("Enter the length in inches : "))
cm=convert(inches)
print("The length in cms is : " , cm)
def convert(length):
return length * 2.54
inputData()
Ans. The length in cms is : 30.48
Introductonnton unctono 197

