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

Conditional Statements in Python Code

The document outlines a series of conditional statements and loops for categorizing individuals based on age and gender, determining fare discounts accordingly. It also includes examples of list operations and a function definition that prints a greeting message. The logic presented is aimed at processing user input and performing calculations based on specified conditions.
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)
3 views2 pages

Conditional Statements in Python Code

The document outlines a series of conditional statements and loops for categorizing individuals based on age and gender, determining fare discounts accordingly. It also includes examples of list operations and a function definition that prints a greeting message. The logic presented is aimed at processing user input and performing calculations based on specified conditions.
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

1.

If age < 10:


Print (“Children”)

If age > 60:

print (‘senior citizens’)

If 10< age> 60:

print (‘normal citizen’)

2. If male and sr. citizen :

Print (“ 70% of fare is applicable”)

Print(fare*=0.7)

If female and sr. citizen :

Print (“50% of fare is applicable.”)

Print(fare*=0.5)

If female and normal citizen :

Print (“ 70% of fare is applicable”)

Print(fare*=0.7)

If male and normal citizen

Print (“ 100% of fare is applicable”)

3. If num > 0:
If num/5==0:
Print(“condition satisfied”)
Else:
Print(“condition is not satisfied”)

Conditional statements
1. A. Print(list1)
B. for i in range(0,n)
Print(i)
C. n = input (“”)
. for i in range(0,n)
Print(i)
2. list1= [0,1,2,3....9]
list2= ['zero','one','two',.... ,'nine']
list3=[Link]()
list3=[Link]()

3. list1 [3,4,5,6,7,8]
for i in list1:
if i /2 ==0:
i+=10
else:
i*=5
4. def function1 ( name , message = “how are you” ):
print (f ”hello {name}, {message}”)
function1(chaitanya,message)

You might also like