0% found this document useful (0 votes)
2 views2 pages

Student Coding Notes H.python - August

The document outlines a coding club activity focused on Python programming, specifically covering conditional statements such as if, if-else, and if-elif-else. It provides examples demonstrating how to implement these statements to determine if a number is odd or even, and to compare values. The document serves as a guide for students to practice coding and flowchart illustration using software.

Uploaded by

dbalan1982
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)
2 views2 pages

Student Coding Notes H.python - August

The document outlines a coding club activity focused on Python programming, specifically covering conditional statements such as if, if-else, and if-elif-else. It provides examples demonstrating how to implement these statements to determine if a number is odd or even, and to compare values. The document serves as a guide for students to practice coding and flowchart illustration using software.

Uploaded by

dbalan1982
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

VELAMMAL BODHI CAMPUS- ATTUR WEEK-2 (PRACTICE

PRACTICE THE ILLUSTRATE FLOW CHART AND CODING -


USING SOFTWARE)
CODING CLUB ACTIVITY FOR HIGH COMPARTMENT
1) Odd or even :
PYTHON CODING – AUGUST MONTH
WEEK-1(STATEMENT CONDITION -if statement, if-else statement) x = int(input(“enter the number”))

1. If Statement: The if statement is used to execute a block of code if a condition is true. if x % 2 == 0:


print(x,"Is Even Number")
else:
IF STATEMENT (EXAMPLE-1)
print(x, "Is Odd Number")
X=10
if X>5:
Print (“X is greater than 5”)

2. If-else Statement: The if-else statement allows you to execute one block of code if the
condition is true and another block of code if the condition is false.

IF-ELSE STATEMENT (EXAMPLE-2)


#python
X=10
num1 = 10
if X>5:
num2 = 4
Print (“X is greater than 5”)
else:
if num1 > num2:

print(“X is lesser than 5”) greatest_number = num1


else:
greatest_number = num2
print("The greatest number is:",
greatest_number)
WEEK-4(PRACTICE
PRACTICE THE IL
ILLUSTRATE
LUSTRATE FLOW CHART AND CODING -
USING SOFTWARE)
WEEK-3(STATEMENT
3(STATEMENT CONDITION - if-elif-else statement)
 The if statement checks a condition, and if it's true, executes a block of code.
 The elif statement (short for "else if") allows you to check additional conditions if
the preceding if statement is false.
 The else statement is executed if none of the preceding conditions are true. It's
optional and comes at the end. You can only have one else statement, and it's
usually the last part of the if statement.

SYNTAX
if [statements]:
#block of code to execute if statement is true

elif[statements]:
#block of code to execute if statement is false and elif statement is true

else[statements]: n=int(input(“Enter the number”))


# if the number is positive
#block of code to execute both if statement and elif statement are false
if n > 0:
print("Positive")

# if the number is negative


elif n < 0:
print("Negative")

# if the number is equal to


# zero
else:
print("Equal to zero")

EXAMPLE
price = 50
if price > 100:
print("price is greater than 100")
elif price == 100:
print("price is 100")
else price < 100:
print("price is less than 100")

You might also like