0% found this document useful (0 votes)
3 views

Python full stack devoper (3)

notes of python

Uploaded by

Sneha Bankar
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

Python full stack devoper (3)

notes of python

Uploaded by

Sneha Bankar
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 41

PYTHON FULL STACK DEVOPLER

Basic program

1) Addition + ?

2) Subtraction - ?

3) Multiplication * ?

4) Divide / ?

5) Mode % ?

6) Addition of 5 number ?

7) Multiplication of 5 number ?

8) Take User value ?

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

10) Area of Rectangle ?

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

11) Area of Triangle ?

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

12) Area of KE kinetic energy ?

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

13) Area of potential energy ?

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

14) Arithmetic means and Harmonic means ?

a=int(input("enter a= "))

b=int(input("enter b= "))

am=(a+b)/2
PYTHON FULL STACK DEVOPLER
hm=(a-b)/2

print("AM= ",am, "HM= ",hm)

o/p:

enter a= 15

enter b= 20

AM= 17.5 HM= -2.5

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

print("A= ",a, "V= ",v)

o/p:

enter r= 12

enter h= 15

A= 14469.119999999999 V= 6782.4

16) To find the velocity and distance ?

u=int(input("enter u= "))

a=int(input("enter a= "))

t=int(input("enter t= "))

v=u+(a*t)

s=u+(a*t*t)

print("V= ",v, "S= ",s)

o/p:

enter u= 15

enter a= 12

enter t= 13

V= 171 S= 2043

17) To find the perimeter of ring ?


PYTHON FULL STACK DEVOPLER
a=int(input("enter a= "))

b=int(input("enter b= "))

p=2*3.14*(a+b)

a=2*3.14*(a-b)*(a+b)

print("P= ",p, "A= ",a)

o/p:

enter a= 5

enter b= 10

P= 94.2 A= -471.00000000000006

18) SA and value of cubical ?

l=int(input("enter l= "))

b=int(input("enter b= "))

h=int(input("enter h= "))

SA=2*(l*b + l*h + b*h)

V=l*b*h

print("SA= ",SA, "V= ",V)

o/p:

enter l= 10

enter b= 15

enter h= 20

SA= 1300 V= 3000

19) To find Temperature in C & Kelvine?

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?

m1=int(input("Enter m1= "))

m2=int(input("Enter m2= "))

m3=int(input("Enter m3= "))

m4=int(input("Enter m4= "))

m5=int(input("Enter m5= "))

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

o/p= calculate total area with roof is painted?

l=int(input("Enter l= "))

b=int(input("Enter b= "))

h=int(input("Enter h= "))

l1=int(input("Enter l1= "))

h1=int(input("Enter h1= "))

l2=int(input("Enter l2= "))

h2=int(input("Enter h2= "))

area=(2*(l*b + l*h + b*h))-((l1*h1)-(l*b)-(2*(l2*h2)))

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

hra(Home Rental Allowance)

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

o/p: hra ta da tax gs.?

bs=int(input("Enter bs= "))

hra=bs*0.50

ta=bs*0.40

da=bs*0.60

tax=bs*0.5

gs=(bs+hra+ta+da-tax)

print("Hra=",hra, "Ta=",ta, "Tax=",tax, "Da=",da, "GS=",gs)

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

after execution of program

a=200 b=110?

a=int(input("Enter a="))

b=int(input("Enter b="))

c=a

a=b

b=c

print("a= ",a, "b= ",b)

output:-

Enter a=12

Enter b=15

a= 15 b= 12

24) without using third variable swapping program.?

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

25) /,% divided & mode explain the operator?

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

2 6) i/p= m , o/p= km?

m=int(input("meter= "))

km=int(m/1000);

m=m%1000;

print("km=",m/1000, "meter=",m%1000)

output:-

meter= 8456

km= 0.456 meter= 456

27) i/p=ml , o/p=litter?

ml=int(input("mili litter= "))

litter=int(ml/1000);

print("litter=",ml/1000)

output:-

mili litter= 200

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

29) i/p=Rs, o/p= ?

30) Revise no=4321 o/p, input-1234?

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

30) if-else program?

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

31) number is divisible by 7 or not?

n=int(input("enter n="))

if n%7==0:

print("n is divisible by 7")

else:

print("n is not divisible by 7")

output:-

enter n=49

n is divisible by 7

32) Leap year or not ?

n=int(input("enter n="))

if n%4==0:

print("n is leapyear")

else:

print("n is not leapyear")

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:

print("n is divisible by 5 or 7")

else:

print("n is not divisible by 5 or 7")

output:-

enter n=48

n is not divisible by 5 or 7

34) divisible by 5 and 7?

n=int(input("enter n="))

if n%5==0 and n%7==0:

print("n is divisible by 5 and 7")

else:

print("n is not divisible by 5 and 7")

output:-

enter n=35

n is divisible by 5 and 7

35) number negative and positive?

n=int(input("enter n="))

if n>0:

print("n is Positive number")

elif n<0:

print("n is Negetive number")

output:-

enter n=-45

n is Negetive number

36) max 2 number?


PYTHON FULL STACK DEVOPLER
a=int(input("a="))

b=int(input("b="))

c=int(input("c="))

if a>b and a<c:

print("a is max")

else:

print("c is max")

output:-

a=4

b=5

c=4

c is max

37) check weather a is between A & B?

38) check weather b is between A & C?

39) check weather c is between A & C?

40) i/p=sp, cp o/p=loss, profit, nil?

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:

print("No profit", "No Loss")

output:-
PYTHON FULL STACK DEVOPLER
sp=10000

cp=6000

total= 4000 per= 40.0

41) Accept age from user check whether he / she is eligible for routing or not?

i/p=age , o/p=yes & no

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…..?

46) B is between first no and third?

47) c is between a and c?

48) Voting eligibility i/p= age, o/p=eligibility or not?

49) Max from three number?

50) Minimum from 3 no. possibility for 7?

51) Max from 4 no. possibility 24?

52) Accept amount from user if amount is less than

Amt<10000 no disc

Amt>=10000 && amt<=20000 5% disc

Amt >=20000 && amt<=50000 7% disc

Amt >= 50000 10%disc

i/p=amount o/p=disc, total pay

53) Accept bs from user and display its tax

Bs<15000 no tax

Bs>=15000 & bs<300000 5% tax on bs

Bs>=300000 7% tax on bs

54) I/p=sales o/p=tax


PYTHON FULL STACK DEVOPLER
Sales>=10000 && sales<20000

55) Accept (+,+),(+,-),(-,-),(-,+),(0,+),(+,0) ,(-,0), (0,-),(0,0)

56) 3 subject Marks from user and display it total, per and class

i/p= m1,m2,m3

o/p= total, per

57) light bill Electricity charge ?

58) Accept charge for user and check weather its vowel or not?

59) Accept chart for user and its alphabet 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 ?

***********Nested –if-else ****************

63) Divisible by 5 & 7?

n=int(input("Enter n= "))

if n%5==0:

if n%7==0:

print("div by 5 and 7")

else:

print("div by 5 not 7")

else:

if n%7==0:

print("div by 7 not 5")

else:

print("div by not 5 not 7")

output:-

Enter n= 48

div by not 5 not 7

64) Max from 3 no?

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

65) Minimum from 3 number?

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

66) Max from 4 number?

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:

print("a is less then b,c and d")

if b>c:

if b>d:

print("b is greater...")

else:

print("b is less then a,c and d")

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:

print("d is less then a,b and c")

else:

print("invalid opration....")

output:-

Enter a= 10

Enter b= 16

Enter c= 25

Enter d= 35

c is less then a,d and d

d is greater

67) accept hb, age wt?

age=int(input("Enter age= "))

hb=int(input("Enter HB= "))

wt=int(input("Enter WT= "))

if age>=18:

if wt>=0:

if hb>=12:

print("eligibile...")

else:

print("Not valid HB")

else:

print("Not valid WT")

else:
PYTHON FULL STACK DEVOPLER
print("Not valid age")

output:

Enter age= 24

Enter HB= 15

Enter WT= 65

eligibile…

68) 10th ,12th,BE>=60 is eligibility or not?

ten=int(input("10th Marks= "))

twelveth=int(input("12th Marks= "))

BE=int(input("BE Marks= "))

if ten>=60:

if twelveth>=60:

if BE>=60:

print("eligibile...")

else:

print("Not valid 10th")

else:

print("Not valid 12th")

else:

print("Not valid BE")

output:-

10th Marks= 65

12th Marks= 52

BE Marks= 78

Not valid 12th

****************if-else program**************

69) 4 subject marks Distinction, display All Clear, Fail, ATKT?


PYTHON FULL STACK DEVOPLER
**************Conditional Program************

1. Arithmetic operator

2. Condition operator

3. Relation operator

4. Logical operator

5. bitwise operator

6. Increments operator / Decrement operator

7. Assignment operator

8. Special operator

70) MAX form 3 number?

a=7867

b=960

c=345

d=a if (a > b and a > c) else b if b > a and b > c else c

print(d)

output:-

7867

*****Match Case***************

71)……………………….?

print("1.even and odd program..")

print("2.divisible by 17...")

print("3.divisible by 5 & 7...")

print("4.divisible by 5 or 7...")

print("5. Leapyear or not...")

print("6.Positive and negative...")

print("7.Calculate electricity bill...")

print("8.Check age for eligible voting...")

print("9.Find the discount...")

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:

print("not divisible by 7...")

case 3:

n = int(input("n= "))

if n%5==0 and n%7==0:

print("divisible by 5 and 7")

else:

print("not divisible by 5 and 7")

case 4:

n = int(input("n= "))

if n%5==0 or n%7==0:

print("divisible by 5 or 7")

else:

print("not divisible by 5 or 7")

case 5:

n = int(input("n="))
PYTHON FULL STACK DEVOPLER
if n>0:

print("it Positive number...")

else:

print("it negative number....")

case 6:

n = int(input("n="))

if year%400==0 and year%100==0:

print("is a leap year...")

else:

print("is not leap year...")

case 7:

units = int(input("number of unit consumed:"))

if (units>0 and units<=200):

payamount=units*1.5

fixedcharge=25.00

print("payamount",payamount, "fixedcharge",fixedcharge)

elif(units>100 and units<=300):

payamount=(100*1.5)+(units-100)*2.5

fixedcharge=50.00

print("payamount",payamount, "fixedcharge",fixedcharge)

elif(units>200 and units<=300):

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

print("electricity bill by %2f:" %total)

case 8:

age = int(input("please enter your age="))

if age>=18:

print("your age is eligible")

else:

print("not eligible for voting")

case 9:

amut = int(input("enter amut="))

if (amut<=5000):

(amut*5)/1000

print("amut if discount 5% is ",)

elif amut<=15000:

(amut*12)/1000

print("amut is discount 12% is ")

elif amut<=25000:

(amut*15)/1000

print("amut is discount 15% is ")

else:

print("invalid....")

case 10:

pin = int(input("please enter pin"))

if pin>=6 and pin<=16:

print(pin,"pin is valid number..")

else:

print("pin is invalid...")
PYTHON FULL STACK DEVOPLER
ouptput:-

1.even and odd program..

2.divisible by 17...

3.divisible by 5 & 7...

4.divisible by 5 or 7...

5. Leapyear or not...

6.Positive and negative...

7.Calculate electricity bill...

8.Check age for eligible voting...

9.Find the discount...

10.check pin...

selected the choice= 8

please enter your age=15

not eligible for voting

72)…………………………………………………………?

print("1. first no is between second no and thrid no")

print("2. min from 3 number")

print("3. max from 3 number")

print("4. check Atkt")

print("5. Triangle")

print("6. Blood donation")

print("7. Aptitude exam")

choice = int(input("please choice its number:"))

print("\n")

match choice:

case 1:

n1=int(input("enter the number of n1= "))

n2=int(input("enter the number of n2= "))


PYTHON FULL STACK DEVOPLER
n3=int(input("enter the number of n3= "))

if n1>n2 and n1>n3:

print("first number")

elif n2>n3:

print("second number")

elif n3>n1 and n3>n2:

print("thrid number")

else:

print("invalid....")

case 2:

a=int(input("a="))

b=int(input("b="))

c=int(input("c="))

if a<b and a<c:

print("a is min")

elif b<c:

print("b is min")

elif c<a and c<b:

print("c is min")

else:

print("invalid...")

case 3:

a=int(input("a="))

b=int(input("b="))

c=int(input("c="))

if a>b and a>c:

print("a is max")

elif b>c:
PYTHON FULL STACK DEVOPLER
print("b is max")

elif c>a and c>b:

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

if m1>=35 and m2>=35 and m3>=35 and m4>=35:

result=""

if per>=85 and per<=99:

result=("A+ first class")

elif per>=75 and per<=84:

result=("B+ second class")

elif per>=65 and per<=74:

result=("B+ thrid class")

elif per>=55 and per<=64:

result=("B-")

elif per>=45 and per<=54:

result=("D+")

elif per>=35 and per<=44:

result= ("D-")

else:

print("invalid input")

print("Congratulations you are pass..."+result)


PYTHON FULL STACK DEVOPLER
else:

print("sorry your are Atkt fail...")

case 5:

b=float(input("base="))

h=float(input("height="))

A=0.5*b*h

print("Area of Triangle= ")

case 6:

age=int(input("age:"))

wt=int(input("weight:"))

hb=int(input("hb:"))

if age>=18:

if wt>=84:

if hb>=12:

print("you are eligible for Blood donation..")

else:

print("sorry you have not eligible for hb")

else:

print("sorry you have not eligible for wt")

else:

print("sorry you have not eligible for weight")

case 7:

ten=int(input("10th marks="))

tweleth=int(input("12th marks="))

graduation=int(input("BEth marks="))

if ten>=60 and tweleth>=60 and graduation>=60:

print("Congratulations your eligible for Aptitude exam...")

else:
PYTHON FULL STACK DEVOPLER
print("sorry your not eligible for Aptitude exam....")

case _:

print("invalid operation.....")

output:-

1. first no is between second no and thrid no

2. min from 3 number

3. max from 3 number

4. check Atkt

5. Triangle

6. Blood donation

7. Aptitude exam

please choice its number:6

age:26

weight:85

hb:20

you are eligible for Blood donation..

******************for loop***************

73) display 10 time “Welcome to python”?

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

74) Display 10 number?

for i in range(10):

print("",i)

output:

75) Sum 10 display?

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

76) Even number?

for i in range(2,12,2):

print(i)

output:-

2 4 6 8 10

77) odd numer?

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)?

79) Print no. from 200 to 1 ?

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

80) print no. from 1000 to 100 within gap between 50 ?

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 ?

85) Prime no.?

86) Perfect no?

87) Fibonacci series?


n=int(input("enter= "))

f1=0

f2=1

if n<=0:

print("invalid")

elif n==1:

print(" ",f1)

else:

print(" ",f1, " ",f2)

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

88) GCD & LCM?

a=int(input("a="))

b=int(input("b="))

if (a<b):

n=a

else:

n=b

for i in range(1,n+1,1):

if a%1==0 and b%1==0:

gcd=i

lcm=int((a*b)/gcd)

print(" ",lcm, " ",gcd )

output:-

a=12

b=48

48 12

89) charter from user?

ch=(input("enter a character: "))

n=int(input("how many character: "))

ch1=ord(ch)

for i in range(n):

print(" ",chr(ch1))
PYTHON FULL STACK DEVOPLER
ch1=ch1+1

output:-

enter a character: G

how many character: 10

*************************Nested for loop*******************************

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

for i in range(1, n + 1):

for j in range(1, n + 1):

if j <= i:

print(i, end=' ')

else:

print(j, end=' ')

print()

output:-

12345

22345

33345

44445

55555

99)………………….?

n=6

for i in range(0, n):

for j in range(0, i + 1):

print("*", end=' ')

print(" ")

for i in range(n + 1, 0, -1):

for j in range(0, i - 1):

print("*", end=' ')


PYTHON FULL STACK DEVOPLER
print(" ")

output:-

**

***

****

*****

******

******

*****

****

***

**

100)………………………………?

print("Print equilateral triangle Pyramid using asterisk symbol ")

# printing full Triangle pyramid using stars

size = 7

m = (2 * size) - 2

for i in range(0, size):

for j in range(0, m):

print(end=" ")

# decrementing m after each loop

m=m-1

for j in range(0, i + 1):

print("* ", end=' ')

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):

print (" # ",end=" ")

else:

print(" * ",end=" ")

for j in range(0,n):

if (j%2==0):

print('* ' , end=' ')

else:

print(" # ",end=" ")

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(' ', end='')

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

You might also like