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

Python Book Programming

Pythone Book programming

Uploaded by

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

Python Book Programming

Pythone Book programming

Uploaded by

Vijay
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

# pg 192 program 1

for i in range(5,0,-1):
for j in range(i,1,-1):
print("*",end=" ")
print("\n")
# page 192 program 2
for i in range(1,1001):
if i%7==0:
print(i," divisable by 7")
elif i%5==0:
print(i," multiple of 5")
else:
continue
print("thank you")
#pg 193 p3
n=int(input("enter the last number in the series"))
sum=0
for i in range(1,n+1):
sum=sum+i
print("the sum of 1+2+3+.......+",n,"is=",sum)
#pg 193 prom 4
for i in range(1,5):
valueA=65
for j in range(1,i+1):
print(chr(valueA),end=' ')
valueA=valueA+1
print("\n")
#pg 193 pg 5
n=int(input(" enter the last no in the series"))
n1=n
s=0
if n%2==0:
n=n+2
else :
n=n+1
for i in range(2,n,2):
s=s+i
print("the sum of series 2+4+....+",n1,"is= ",s)
#pg 193 prog 6
n=int(input("enter the last no in the series"))
s=0
for i in range(1,n+1):
s=s+i**2
print("the sum of series is",s)

# pg 193 program 7
st=input("enter the string")
l=len(st)
print(l)
for i in range(l-1,-1,-1):
print(st[i],end= ' ')

You might also like