Page 301 - Computer Science Class 11 With Functions
P. 301
else:
print(math.factorial(localNumber))
number = number - 5
6. What will be the output produced on the execution of the following code?
import math
x = divmod(42, 4)
y = int(math.fmod(10, 3))
z = x + (y,)
print(z)
7. In each of the following cases, give a function call/ expression that will yield the desired output:
a. An even random integer from the first 500 natural numbers.
b. A randomly chosen multiple of five from the first 500 natural numbers.
c. Value of pi upto 4 decimal places.
d. log (100)
2
e. log (1000)
10
f. log (1000)
e
g. Sine of an angle having degree 90.
h. Cosine of an angle having degree 90.
i. Greatest common divisors of 20 and 34.
j. Mean age of five children having ages 50, 54, 60, 61, and 65 cm .
k. Factorial of the number 10.
8. Write a function call that would randomly generate 0 or 1. Write a Python script that makes use of the function call 20
times. How many times do you get 0? Repeat the experiment 10 times. Do you get the same result every time? Interpret
the result.
9. For each of the following patterns, write a function that accepts a parameter nRows - the number of rows in the pattern
and prints the pattern.
Half Pyramid Inverted Hollow Inverted
Half Pyramid Half Pyramid
Full Pyramid Inverted Hollow
Full Pyramid Full Pyramid
Modules 299

