#3 arithemetic operation
n1 = int(input("enter first number"))
n2 = int(input("enter second number"))
a = n1+n2
b = n1-n2
c = n1*n2
d = n1/n2
e = n1%n2
print(a,b,c,d,e)
#5 grade
name = input("enter name")
roll_no = int(input("enter roll no"))
mark1 = int(input("enter mark of 1:-"))
mark2 = int(input("enter mark of 2:-"))
mark3 = int(input("enter mark of 3:-"))
mark4 = int(input("enter mark of 4:-"))
mark5 = int(input("enter mark of 5:-"))
sum=mark1+mark2+mark3+mark4+mark5
print("your total marks is :-",sum)
per=(sum*100)/500
print("your percentage is:- ",per)
if per>=90:
print("grade a")
elif per>=80 and per<90:
print("grade b")
elif per>=70 and per<80:
print("grade c")
elif per>=60 and per<70:
print("grade d")
else:
print("grade f \nBetter Luck Next Time")
acute angle
the factorial is :- 24
5 * 0 = 0
5 * 1 = 5
5 * 2 = 10
5 * 3 = 15
5 * 4 = 20
5 * 5 = 25
5 * 6 = 30
5 * 7 = 35
5 * 8 = 40
5 * 9 = 45
5 * 10 = 50
number is prime
print(mytuple[1])
print(mytuple[4])
mytuple=(1,2,3,4,2,3)
print(mytuple)
2
5
(1, 2, 3, 4, 2, 3)
----------------------------------------------------------------------
-----
TypeError Traceback (most recent call
last)
Cell In[50], line 10
7 mytuple=(1,2,3,4,2,3)
8 print(mytuple)
---> 10 mytuple[1] = 100
11 print(mytuple)
#17. to create a set and also show whether the set is mutable or
immutable
#Modifying Set
a = {11,13}
print ("original set:-",a)
#adding an item
a.add(12)
print("Adding New items",a)
18. #18 to create a frozen set and also show whether it is mutable or
immutable
fruits=frozenset(["apple","banana","orange"])
print(fruits)
fruits.append("cherry") #frozen set cannot be modified after creation
print(fruits)
----------------------------------------------------------------------
-----
AttributeError Traceback (most recent call
last)
Cell In[3], line 4
2 fruits=frozenset(["apple","banana","orange"])
3 print(fruits)
----> 4 fruits.append("cherry") #frozen set cannot be modified after
creation
5 print(fruits)
----------------------------------------------------------------------
-----
TypeError Traceback (most recent call
last)
Cell In[7], line 4
2 first_name = input("enter your first name")
3 print("Original String is:-",first_name)
----> 4 first_name[3]='t'
5 print(first_name)
poitive indexing
!
negative indexing
H
Welcome
applying concatenation
Hello !! Sir !!Welcome to python coding
applying repletion
Hello !! Sir !!Hello !! Sir !!Hello !! Sir !!
applying comparison
not equal
applying membership
True
#counting words
str=s1.split()
print("total number of words are",len(str))
Wrong password
Wrong password
Wrong password
Right password
Vowels:- 7
Consonant:- 14
space:- 5
special character:- 0
print("Applying Break")
print("the multiplication are:-")
i =1
while i<=10:
print('6*',(i),'=',6*i)
if i>=5:
break
i = i + 1
print("Applying Continue")
print("The Prime number are:-")
num=0
while num<10:
num+=1
if(num%2)==0:
continue
print(num)
Applying Break
the multiplication are:-
6* 1 = 6
6* 2 = 12
6* 3 = 18
6* 4 = 24
6* 5 = 30
Applying Continue
The Prime number are:-
1
3
5
7
9
applying pass statement
b
c
d