Python full stack devoper (3)
Python full stack devoper (3)
Basic program
1) Addition + ?
2) Subtraction - ?
3) Multiplication * ?
4) Divide / ?
5) Mode % ?
6) Addition of 5 number ?
7) Multiplication of 5 number ?
9) Area of circle ?
r=int(input("enter r= "))
a=3.14*r*r
print("A= ",a)
o/p:
enter r= 15
A= 706.5
l=int(input("enter l= "))
b=int(input("enter b= "))
a=l*b
print("A= ",a)
o/p:-
enter l= 42
enter b= 10
A= 420
b=int(input("enter b= "))
h=int(input("enter h= "))
a=0.5*b*h
PYTHON FULL STACK DEVOPLER
print("A= ",a)
o/p:-
enter b= 12
enter h= 15
A= 90.0
m=int(input("enter m= "))
v=int(input("enter v= "))
ke=0.5*m*v*v
print("KE= ",ke)
o/p:
enter m= 10
enter v= 12
KE= 720.0
m=int(input("enter m= "))
g=int(input("enter g= "))
h=int(input("enter h= "))
pe=m*g*h
print("PE= ",pe)
o/p:-
enter m= 10
enter g= 12
enter h= 15
PE= 1800
a=int(input("enter a= "))
b=int(input("enter b= "))
am=(a+b)/2
PYTHON FULL STACK DEVOPLER
hm=(a-b)/2
o/p:
enter a= 15
enter b= 20
15) Surface ?
r=int(input("enter r= "))
h=int(input("enter h= "))
a=(2*3.14*r*r)+(2*3.14*r*r*h)
v=3.14*r*r*h
o/p:
enter r= 12
enter h= 15
A= 14469.119999999999 V= 6782.4
u=int(input("enter u= "))
a=int(input("enter a= "))
t=int(input("enter t= "))
v=u+(a*t)
s=u+(a*t*t)
o/p:
enter u= 15
enter a= 12
enter t= 13
V= 171 S= 2043
b=int(input("enter b= "))
p=2*3.14*(a+b)
a=2*3.14*(a-b)*(a+b)
o/p:
enter a= 5
enter b= 10
P= 94.2 A= -471.00000000000006
l=int(input("enter l= "))
b=int(input("enter b= "))
h=int(input("enter h= "))
V=l*b*h
o/p:
enter l= 10
enter b= 15
enter h= 20
f=float(input("Enter F= "))
c=(915)*(f-32)
k=c+272.15
print("C=",c, "K=",k)
o/p:
Enter F= 48
C= 14640.0 K= 14912.15
PYTHON FULL STACK DEVOPLER
20) Accept 5 subject from user and calculate total and percentage?
t=m1+m2+m3+m4+m5
per=t/5
print("T=",t,"Per=",per)
o/p:
Enter m1= 12
Enter m2= 15
Enter m3= 15
Enter m4= 12
Enter m5= 10
T= 64 Per= 12.8
21) i/p=l,h,b,l1,h1,l2,h2
l=int(input("Enter l= "))
b=int(input("Enter b= "))
h=int(input("Enter h= "))
print("Area=",area,)
o/p:
Enter l= 10
PYTHON FULL STACK DEVOPLER
Enter b= 12
Enter h= 10
Enter l1= 15
Enter h1= 12
Enter l2= 14
Enter h2= 15
Area= 1040
22) Basic salary from user and calculate hra, ta, da, tax, and gs
ta(Travelling Allowance)
da(Dinner Allowance)
tax
gs(Gross Salary)
hra=50% on bs hra=bs*0.50;
ta=40% on bs ta=bs*0.40;
da=60% on bs
tax=5% on bs
gs=(bs+hra+ta+da)-tax;
i/p=bs
hra=bs*0.50
ta=bs*0.40
da=bs*0.60
tax=bs*0.5
gs=(bs+hra+ta+da-tax)
o/p:
Enter bs= 15
PYTHON FULL STACK DEVOPLER
Hra= 7.5 Ta= 6.0 Tax= 7.5 Da= 9.0 GS= 30.0
23) swapping
a=110 b=200
a=200 b=110?
a=int(input("Enter a="))
b=int(input("Enter b="))
c=a
a=b
b=c
output:-
Enter a=12
Enter b=15
a= 15 b= 12
a=int(input("Enter a= "))
b=int(input("Enter b= "))
c=a
a=b
b=c
print("a=",a, "b=",b)
o/p:
Enter a= 10
Enter b= 12
a= 12 b= 10
a=int(input("enter a= "))
b=int(input("enter b= "))
PYTHON FULL STACK DEVOPLER
n=a/b
print("n=",a/b)
output:-
a=8
b=2
n=4.5
a=int(input("enter a= "))
b=int(input("enter b= "))
n=a%b
print("n=",a%b)
output:-
enter a= 12
enter b= 2
n= 0
m=int(input("meter= "))
km=int(m/1000);
m=m%1000;
print("km=",m/1000, "meter=",m%1000)
output:-
meter= 8456
litter=int(ml/1000);
print("litter=",ml/1000)
output:-
litter= 0.2
PYTHON FULL STACK DEVOPLER
28) i/p=seconds , o/p=h,m,s?
s=int(input("s="))
h=(s%3600);
s=s%3600;
m=int(s/60);
s=s%60;
print(h,":", m,":", s)
output:-
s=4568
968 : 16 : 8
n=int(input("enter 1 no="))
a=n%10
n=int(n/10)
b=n%10
n=int(n/10)
c=n%10
n=int(n/10)
print(a,b,c,n)
output:-
enter 1 no=456
6540
****Condition structured*****
If
If-else
Else-if-ladder
Nested-if-else
PYTHON FULL STACK DEVOPLER
<,>,>=,<=,==,!= logical operator
n=int(input("enter n="))
if n%2==0:
print("n is even")
else:
print("n is odd")
output:-
enter n=45
n is odd
n=int(input("enter n="))
if n%7==0:
else:
output:-
enter n=49
n is divisible by 7
n=int(input("enter n="))
if n%4==0:
print("n is leapyear")
else:
output:-
enter n=2020
n is leapyear
enter n=2019
PYTHON FULL STACK DEVOPLER
n is not leapyear
33) divisible by 5 or 7?
n=int(input("enter n="))
if n%5==0 or n%7==0:
else:
output:-
enter n=48
n is not divisible by 5 or 7
n=int(input("enter n="))
else:
output:-
enter n=35
n is divisible by 5 and 7
n=int(input("enter n="))
if n>0:
elif n<0:
output:-
enter n=-45
n is Negetive number
b=int(input("b="))
c=int(input("c="))
print("a is max")
else:
print("c is max")
output:-
a=4
b=5
c=4
c is max
sp=int(input("sp="))
cp=int(input("cp="))
if cp>sp:
total=cp-sp
per=total/cp*100
print("profit=",total, "per=",per)
elif sp-cp:
total=sp-cp
per=total/sp*100
print("loss=",total, "per=",per)
else:
output:-
PYTHON FULL STACK DEVOPLER
sp=10000
cp=6000
41) Accept age from user check whether he / she is eligible for routing or not?
42) Accept pin no from user, check weather pin is valid or not (1234)?
43) Accept balance amount and withdraw amount from user and if balance < withdraw given proper
massage otherwise display balance of amount?
44) Accept no of vaccine and print its eligibility for attending interview or not (vaccine no=2 them
eligible)?
45) accept no. of user and check weather no is 1 digit or 2 digit or…..?
Amt<10000 no disc
Bs<15000 no tax
Bs>=300000 7% tax on bs
56) 3 subject Marks from user and display it total, per and class
i/p= m1,m2,m3
58) Accept charge for user and check weather its vowel or not?
60) Accept chart for user and check weather its digit or not (0 to 9)?
61) Accept chart for user and check weather its special small or capital (a-z,A-Z)?
62) Accept chart for user and check weather its special or not ?
n=int(input("Enter n= "))
if n%5==0:
if n%7==0:
else:
else:
if n%7==0:
else:
output:-
Enter n= 48
a=int(input("Enter a= "))
PYTHON FULL STACK DEVOPLER
b=int(input("Enter b= "))
c=int(input("Enter c= "))
if a>b:
if a>c:
print("a is max")
else:
print("c is max")
else:
if b>c:
print("b is max")
else:
print("c is max")
output:-
Enter a= 30
Enter b= 42
Enter c= 10
b is max
a=int(input("Enter a= "))
b=int(input("Enter b= "))
c=int(input("Enter c= "))
if a<b:
if a<c:
print("b is minimum")
else:
print("c is minimum")
else:
if b<c :
print("b is minimum")
PYTHON FULL STACK DEVOPLER
else:
print("c is minimum")
output:-
Enter a= 10
Enter b= 2
Enter c= 15
b is minimum
a=int(input("Enter a= "))
b=int(input("Enter b= "))
c=int(input("Enter c= "))
d=int(input("Enter d= "))
if a > b:
if a>c:
if a>d:
print("a is greater...")
else:
if b>c:
if b>d:
print("b is greater...")
else:
if c>a:
if c>d:
print("c is greater...")
else:
PYTHON FULL STACK DEVOPLER
print("c is less then a,d and d")
if d>a:
if d>c:
print("d is greater")
else:
else:
print("invalid opration....")
output:-
Enter a= 10
Enter b= 16
Enter c= 25
Enter d= 35
d is greater
if age>=18:
if wt>=0:
if hb>=12:
print("eligibile...")
else:
else:
else:
PYTHON FULL STACK DEVOPLER
print("Not valid age")
output:
Enter age= 24
Enter HB= 15
Enter WT= 65
eligibile…
if ten>=60:
if twelveth>=60:
if BE>=60:
print("eligibile...")
else:
else:
else:
output:-
10th Marks= 65
12th Marks= 52
BE Marks= 78
****************if-else program**************
1. Arithmetic operator
2. Condition operator
3. Relation operator
4. Logical operator
5. bitwise operator
7. Assignment operator
8. Special operator
a=7867
b=960
c=345
print(d)
output:-
7867
*****Match Case***************
71)……………………….?
print("2.divisible by 17...")
print("4.divisible by 5 or 7...")
print("10.check pin...")
PYTHON FULL STACK DEVOPLER
choice = int(input("selected the choice= "))
match choice:
case 1:
n = int(input("enter n= "))
if n%2==0:
print("even no...")
else:
print("odd no...")
case 2:
n = int(input("n= "))
if n%17==0:
print("divisible by 17...")
else:
case 3:
n = int(input("n= "))
else:
case 4:
n = int(input("n= "))
if n%5==0 or n%7==0:
print("divisible by 5 or 7")
else:
case 5:
n = int(input("n="))
PYTHON FULL STACK DEVOPLER
if n>0:
else:
case 6:
n = int(input("n="))
else:
case 7:
payamount=units*1.5
fixedcharge=25.00
print("payamount",payamount, "fixedcharge",fixedcharge)
payamount=(100*1.5)+(units-100)*2.5
fixedcharge=50.00
print("payamount",payamount, "fixedcharge",fixedcharge)
payamount=(100*1.5)+(200-100)*2.5+(units-200)*400
fixedcharge=50.00
print("payamount",payamount, "fixedcharge",fixedcharge)
elif(units>300):
payamount=2500
fixedcharge=75.00
print("payamount",payamount, "fixedcharge",fixedcharge)
else:
PYTHON FULL STACK DEVOPLER
payamount=0
total = payamount+fixedcharge
case 8:
if age>=18:
else:
case 9:
if (amut<=5000):
(amut*5)/1000
elif amut<=15000:
(amut*12)/1000
elif amut<=25000:
(amut*15)/1000
else:
print("invalid....")
case 10:
else:
print("pin is invalid...")
PYTHON FULL STACK DEVOPLER
ouptput:-
2.divisible by 17...
4.divisible by 5 or 7...
5. Leapyear or not...
10.check pin...
72)…………………………………………………………?
print("5. Triangle")
print("\n")
match choice:
case 1:
print("first number")
elif n2>n3:
print("second number")
print("thrid number")
else:
print("invalid....")
case 2:
a=int(input("a="))
b=int(input("b="))
c=int(input("c="))
print("a is min")
elif b<c:
print("b is min")
print("c is min")
else:
print("invalid...")
case 3:
a=int(input("a="))
b=int(input("b="))
c=int(input("c="))
print("a is max")
elif b>c:
PYTHON FULL STACK DEVOPLER
print("b is max")
print("c is max")
else:
print("invalid...")
case 4:
m1=int(input("m1="))
m2=int(input("m2="))
m3=int(input("m3="))
m4=int(input("m4="))
total=m1+m2+m3+m4
per=total*100/400
result=""
result=("B-")
result=("D+")
result= ("D-")
else:
print("invalid input")
case 5:
b=float(input("base="))
h=float(input("height="))
A=0.5*b*h
case 6:
age=int(input("age:"))
wt=int(input("weight:"))
hb=int(input("hb:"))
if age>=18:
if wt>=84:
if hb>=12:
else:
else:
else:
case 7:
ten=int(input("10th marks="))
tweleth=int(input("12th marks="))
graduation=int(input("BEth marks="))
else:
PYTHON FULL STACK DEVOPLER
print("sorry your not eligible for Aptitude exam....")
case _:
print("invalid operation.....")
output:-
4. check Atkt
5. Triangle
6. Blood donation
7. Aptitude exam
age:26
weight:85
hb:20
******************for loop***************
for i in range(10):
print("Welcome to python",i)
output:-
Welcome to python
Welcome to python
Welcome to python
Welcome to python
Welcome to python
Welcome to python
Welcome to python
PYTHON FULL STACK DEVOPLER
Welcome to python
Welcome to python
Welcome to python
for i in range(10):
print("",i)
output:
sum=10
for i in range(10):
sum=sum+i
print("sum=",sum)
output:-
sum= 10
sum= 11
sum= 13
sum= 16
sum= 20
sum= 25
PYTHON FULL STACK DEVOPLER
sum= 31
sum= 38
sum= 46
sum= 55
for i in range(2,12,2):
print(i)
output:-
2 4 6 8 10
For I in number(1,12,2):
Print(i)
Output:-
13579
78) Accept 2 no. for user like x and y and print sum of upto x to y. (Dynamic program)?
for i in range(200,1,-10):
print(i)
output:-
200
190
180
170
160
150
140
PYTHON FULL STACK DEVOPLER
130
120
110
100
90
80
70
60
50
40
30
20
10
for i in range(1000,100,-50):
print(i)
output:-
800
750
700
650
600
550
500
450
400
350
300
PYTHON FULL STACK DEVOPLER
250
200
150
******************Multiplication table****************
81 ?
82 ?
83 ?
84 ?
f1=0
f2=1
if n<=0:
print("invalid")
elif n==1:
print(" ",f1)
else:
for i in range(3,n+1,1):
f3=f1+f2
print(" ",f3)
f1=f2
f2=f3
output:-
enter= 10
0 1
1
PYTHON FULL STACK DEVOPLER
2
13
21
34
a=int(input("a="))
b=int(input("b="))
if (a<b):
n=a
else:
n=b
for i in range(1,n+1,1):
gcd=i
lcm=int((a*b)/gcd)
output:-
a=12
b=48
48 12
ch1=ord(ch)
for i in range(n):
print(" ",chr(ch1))
PYTHON FULL STACK DEVOPLER
ch1=ch1+1
output:-
enter a character: G
90) ………………………..?
n=int(input("enter 1 no"))
ch=64
for i in range(1,n+1,1):
for j in range(1,i+1,1):
print(chr(ch+j),end=" ")
print()
output:-
enter 1 no 5
AB
ABC
ABCD
ABCDE
PYTHON FULL STACK DEVOPLER
91)………………..?
Output:-
22
333
4444
55555
92)……………………………….?
Output:-
12
123
1234
12345
93)…………………………..?
Output:-
Aa
Aa Bb
Aa Bb Cc
Aa Bb Cc Dd
Aa Bb Cc Dd Ee
Aa Bb Cc Dd Ee Ff
94)……………………….?
**
***
****
*****
******
PYTHON FULL STACK DEVOPLER
95)………………….?
$$
$$$
$$$$
$$ $$$
96)……………..?
k=1
n=int(input("Enter no:"))
for i in range(1,n+2,2):
for j in range(1,i+2,2):
k=k+2
print(k,end=" ")
print()
Output
5 7
9 11 13
15 17 19 21
97)…………………………?
k=0
n=int(input("Enter no:"))
for i in range(0,n+1,):
for j in range(1,i+1,):
k=k+1
print(k,end=" ")
print()
output:-
Enter no:4
PYTHON FULL STACK DEVOPLER
1
23
456
7 8 9 10
98)…………….?
n=5
if j <= i:
else:
print()
output:-
12345
22345
33345
44445
55555
99)………………….?
n=6
print(" ")
output:-
**
***
****
*****
******
******
*****
****
***
**
100)………………………………?
size = 7
m = (2 * size) - 2
print(end=" ")
m=m-1
print(" ")
output:-
print equilateral triangle Pyramid using asterisk symbol
PYTHON FULL STACK DEVOPLER
*
* *
* * *
* * * *
* * * * *
* * * * * *
* * * * * * *
101)………………….?
n=4
for i in range(0,n):
if (i%2==0):
else:
for j in range(0,n):
if (j%2==0):
else:
print()
output:-
102)………………………..?
n = 13
for i in range(n):
for j in range(n):
if i == n // 2:
print('*', end='')
else:
PYTHON FULL STACK DEVOPLER
if j == n // 2:
print('*', end='')
else:
print()
output:-
*************
103) ……………….?
n=int(input("enter 1 no:"))
for i in range(1,n+1):
for j in range(1,n+1):
if(i+j)%2==0:
print("#",end=" ")
else:
print("*",end=" ")
print( )
output:
PYTHON FULL STACK DEVOPLER
enter 1 no:4
#*#*
*#*#
#*#*
*#*#
104)……………..?
n=int(input("n= "))
x=int(input("x= "))
f1=1
sum=0
for j in range(1,n+1,1):
f1=1
for i in range(1,j+1,1):
f1=f1*x
sum=sum+f1
print(" ",sum)
output:-
n= 4
x= 3
sum= 81
PYTHON FULL STACK DEVOPLER