PYthon Class 11 Telugu
PYthon Class 11 Telugu
-----------------------------
Control Structures
---------------------
1. Decision Statements
--> simple if
--> if..else
--> if..elif..else
--> Nested if
2. Looping Statements
--> For Loop
--> While Loop
3. Transfer Statements
--> Break
--> Continue
--> Pass
Software Engineers
~~~~~~~~~~~~~~~~~~~
Task
~~~~~~~~~~
eg:
Marks Result
-------- ----------------
mpc>=35 Pass
--- Fail
eg:2
print("\n"*2)
print("--------------------STUDENT MARKS LIST-------------------")
print("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~")
print("\n"*2)
print("\n"*2)
print("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~")
If..elif..else
====================
Syntax:
~~~~~~~~~~
if(condition1):
statements
statements
elif(condition2):
statements
statements
elif(condition2):
statements
statements
.
.
.
else:
statements
statements
eg:
Marks Grade
--------------- -------------------------
--------------- Fail
print("\n"*2)
print("--------------------STUDENT MARKS LIST-------------------")
print("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~")
print("\n"*2)
else:
print("Grade = Fail")
print("\n"*2)
print("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~")
eg:
# Program to display the Electricity Bill based on the given condition
Mtno, Name, PMR, CMR, Difference, Unit Charge, Total Amount
0-100 1
101-250 2
251-400 3
401-650 4
651-850 5
---- 7
diff=cmr-pmr
ta=diff*uc
print("\n"*2)
print("------------------------ELECTRICITY BILL----------------------")
print("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~")
print("\n"*2)
print("\n"*2)
print("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~")
----------------------------------------------------------------------------
Nested if
~~~~~~~~~~~~~~~
Syntax:
~~~~~~~~~~~
if(condition1):
if(condition1.1):
statements
statements
elif(condition1.2):
statements
statements
elif(condition1.3):
statements
statements
.
.
.
else:
statements
statements
else:
if(condition2.1):
statements
statements
elif(condition2.2):
statements
statements
elif(condition2.3):
statements
statements
.
.
.
else:
statements
statements
eg:
# Program to display the person details
print("\n"*5)
print("----------------------AGE CALCULATOR-------------------------")
print("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~")
print("\n"*2)
print("Name = ",nm)
print("Age = ",age)
if(type=="male"):
if(age>=0 and age<=10):
print(nm," You are a Kid and you are ",age," years old")
else:
print(nm," You are a Senior Citizen and You are ",age," years old")
else:
if(age>=0 and age<=10):
print(nm," You are a Baby girl and you are ",age," years old")
else:
print(nm," You are a Senior Citizen(Woman) and You are ",age," years
old")
print("\n"*2)
print("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~")