Page 68 - Computer - 7
P. 68
D. Answer the following questions.
1. What is decision making?
2. What are Conditional statements?
3. Write the syntax of all the conditional statements available in Python.
4. What is Indentation of statements in Python? What is its benefit?
5. Explain the working of the if … else statement with an example.
Mind Stretching
1. Identify and underline the errors in the code given below. Also, write the correct code. Logical Thinking
(a) # Program to accept two numbers and display the larger number
Num1 = input(“Enter first number : ”)
Num2 = input(Enter second number : ”)
If Num1 > Num2
show(“Second number is greater”)
else:
print(“Second number is greater”).
(b) # Program to accept two numbers. If the numbers are equal, display
their product otherwise, display the remainder when the larger
number is divided by the smaller number.
Num1 = input(“Enter first number : ”)
Num2 = input(“Enter second number : ”
Num2 = int(Num2)
Num1 = int(Num1)
If Num1 = Num2:
print(Num1 * Num2)
Else if (Num1 > Num2):
print(“Num1 / Num2”)
else:
print(Num2 % Num1)
2. Write the output of the following code segments in Python: Computational Skills
(a) if A % B == 0:
print(A, “is divisible by”, B)
else:
print(A, “is not divisible by”, B)
(i) when A = 50, B = 10 (ii) when A = 42, B = 8
66