Professional Documents
Culture Documents
Python Notes: From Import
Python Notes: From Import
Python Notes: From Import
print(floor(3.7))= 3
similar ceil for opposite
sqrt for squire root
we can use friends.append to add the new friend in the list but it will
add in the end only
to add in between we can use
friends.insert(1,”Dinesh”) where 1 shows position and second friends
name
friends.remove(“name”) to remove the specific friends and
friends.clear to delete all the friends
friends.pop() to remove last person of the list
the main difference in tuple and list is that data in tuple cannot be
changes but can be done in case of list.
functions
def say_hi(name, age):
print("Hello " + name + ", you are " + age +",")
say_hi("mike", "35")
say_hi("hero", "15")
def cube(num):
return num*num*num
print(cube(5))
if statement
is_Nidhi = True
is_Neha = False
if is_Nidhi or is_neha:
print("You are great women")
else:
print("you r bad women")
if and or statement
is_Nidhi = True
is_Neha = False
if is_Nidhi and not(is_Neha):
print("you are my women")
elif not(is_Nidhi) and is_Neha:
print("you are my Di")
else:
print("you r bad women")
if op == "+":
print(num1 + num2)
elif op == "-":
print(num1 - num2)
elif op == "*":
print(num1 * num2)
elif op == "/":
print(num1 / num2)
else:
print("Invalid input")
while loop