0% found this document useful (0 votes)
28 views6 pages

Chapter 9-LEARNING CONDITIONAL STATEMENTS-GRADE 7

Chapter 9 covers learning conditional statements for Grade 7, including multiple-choice questions, true/false statements, and explanations of if, if-else, and if-elif-else statements. It provides syntax examples and significance of these statements in programming, along with practical programming exercises such as determining leap years, voting eligibility, finding the largest of three numbers, and temperature categorization. The chapter emphasizes the use of conditional statements to control the flow of programs based on specific conditions.

Uploaded by

Abi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
28 views6 pages

Chapter 9-LEARNING CONDITIONAL STATEMENTS-GRADE 7

Chapter 9 covers learning conditional statements for Grade 7, including multiple-choice questions, true/false statements, and explanations of if, if-else, and if-elif-else statements. It provides syntax examples and significance of these statements in programming, along with practical programming exercises such as determining leap years, voting eligibility, finding the largest of three numbers, and temperature categorization. The chapter emphasizes the use of conditional statements to control the flow of programs based on specific conditions.

Uploaded by

Abi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

Chapter 9-LEARNING CONDITIONAL STATEMENTS-GRADE 7

A.Choose the correct Option


1.b

2.b

3.b

4.a

5.a

6.b

7.a

8.a

B.True or false

C.Answer the following

1.Write the syntax of if statement.

Ans:Syntax:
If condition:
Set of statement(s)
2.Explain the working of if-else statement

Ans:An if-else statement is a control structure in programming that executes different blocks of
code based on whether a condition is true or false.

How it works
●​ The if-else statement evaluates a condition
●​ If the condition is true, the code in the if block is executed
●​ If the condition is false, the code in the else block is executed

3.What is the significance of if-elif-else statement?

Ans:The if-elif-else statement is a conditional statement in Python that lets you execute different
code based on a condition. It's useful for handling multiple conditions and complex scenarios.

4.Can a if-else block without the else block?

Ans:Yes

5.In case the if condition evaluates to false,then which block statements will work?

Ans:Else block

D.Create following programs

1.Write a program to find whether a given year is leap year or not.

year=int(input('Enter the year'))

if(year % 4 == 0 and year % 100 != 0) or (year % 400 == 0):


print('It is a leap year')
else:
print('It is not a leap year')
2.Write a program to read the age of a candidate and determine whether he/she is eligible for
casting his/her own vote

Ans:age=int(input('Enter the age'))


if age>=18:
print('You are eligible for casting your vote')
else:
print('You are not eligible for casting your vote')

3.Write a program to find largest of 3 numbers.

num1=int(input('enter number1'))
num2=int(input('enter number2'))
num3=int(input('enter number3'))
if(num1>num2) and (num1>num3):
print(num1,"is greater")
elif (num2>num1) and (num2>num3):
print(num2, "is greater")
else :
print(num3, "is greater")

4.Write a program to read temperature in centigrade and display a suitable message according to
temperature.
Temp=int(input("Enter the Temperature"))
if Temp<0:
print("freezing weather")
elif (Temp>=0 and Temp<10):
print("very cold weather")
elif (Temp>=10 and Temp<20):
print("cold weather")
elif (Temp>=20 and Temp<30):
print("Normal weather")
elif (Temp>=30 and Temp<40):
print("hot weather")
elif (Temp>=40):
print("very hot weather")

5.Write a program to read any digit between 1 to 9.Display it in the word


Ans:val=int(input('enter any number between 1 and 9'))
if(val==1):
print("One")
elif(val==2):
print("Two")
elif(val==3):
print("Three")
elif(val==4):
print("Four")
elif(val==5):
print("Five")
elif(val==6):
print("Six")
elif(val==7):
print("Seven")
elif(val==8):
print("Eight")
elif(val==9):
print("Nine")

You might also like