april26.
py
'''
Scripting Mode -->We use triple quote notation for describing the content
so technically we call it as Doc String..
#have a proper location for saving the files create a folder
Variables (no spaces,no special characters,don't start with number,but evenn
underscore can be taken)
Data types ->Numeric (int,float,complex),bool(True/False),
collections ([] Lists, ()Tuples,{} Sets,Dictionaries,'' Strings)
name = "Codegnan"
print(name)
print(type(name)) #return object type
print(name[3])
#print(Name[3]) #NameError
#print(name[31]) #indexing #Index Error
print(name[:3]) #Slicing
'''
names = ['Codegnan','Saketh','NRI','Akash','Sanjana']
#o/p should be as below
'''
0 : Codegnan
1 : Saketh
2 : NRI
3 : Akash
4 : Sanjana
for <loop_var> in sequence/function :
statement(s)...
for i in names:
print(names.index(i),':',i)
for i in range(len(names)):
#print(i,':',names[i])
#using f-string notation widely recommended after Python 3.7.x versions
print(f"{i} : {names[i]}") #try to follow this notation which makes
#your coding journey perfect
#Now its time to use another widely used built-in function -->enumerate
#enumerate always returns an object from the collection as a pair (tuple)
#for i in enumerate(names):
#print(i)
for i,j in enumerate(names):
print(i,':',j) #here automatically it retrieves index
'''
#Now let us work on calculating BMI by accepting inputs from user
#bmi = weight (kgs) / (height)**2 (metres)
#1 foot = 12 inches = 30.48 cm
weight = float(input("Enter the weight in kgs"))
#print(weight)
height = float(input("Enter the height in metres"))
#print(height)
bmi = weight / ((height)**2)
#print(bmi)
'''
bmi < 18.5 -->Underweight
>=18.5 - 24.9 ---> Normal Weight
>=25 - 29.9 --> Overweight
>30 -->Obesity
if,else,elif -->Conditional Statements
if weight > 0 and height > 0:
if bmi < 18.5:
print(f'Sarigaa tinuuu lekpotey aypothavyuu nee bmi {bmi}')
elif bmi >=18.5 and bmi<=24.9:
print(f'Superr keep on track your bmi is {bmi}')
elif bmi >=25 and bmi <=29.9:
print(f'Ikaa Jogging cheypooo lekpotey anthey bmi is{bmi}')
else:
print("Obesity")
else:
print("Values sarigaa ivuuu only +ve lekpotey poo")
'''
#Task1 -->You need to create a bmi calculator but it should accept name,weight,
#height from user and it should repeat for 5 times
#Functions -->User defined functions,Built-in Functions,Anonymous Functions
#A block of statements/code that performs a specific task
'''
def fname(*args,**kwargs): #functn deftn
"""Doc String (description of function)"""
statement(s).....
return value(s) #body of functn
fname(*a,**b) #functn call
'''
#Task-2 : Create a BMI Calculator Function satisfying task1
#submit the tasks (.py) files on
[email protected]#subject as Your Name,RollNo,Branch
#Codegnan Academy -->Signup -->Python Free
#Google PlayStore -->CodegnanDestination