You are on page 1of 3

EXPERIMENT – 1

AIM : Write a program to print Fibonacci Sequence using Python.

# program to display the fibonacci sequence upto nth term


terms = int(input("how many terms you want?"))
a=0
b=1
sum = 0
count = 1
print('Fibonacci Series : ',end ="")
while(count<=terms):
print(sum,end ="")
count+=1
a=b
b = sum
sum = a+b

OUTPUT
EXPERIMENT – 2

AIM : Write a program to print the reverse of a list using Python.

# reverse the list

lst = []
n = int(input("enter the number of elements : "))
for i in range(0,n+1):
ele = int(input("enter the value of %d element :"%i))
lst.append(ele)
print(lst)
lst.reverse()
print("reversed list:",lst)

OUTPUT
EXPERIMENT – 3

AIM : Write a program to print a triangular pattern using python.

# print triangular pattern


rows = int(input("Enter the number of rows \n"))
for i in range(rows):
for j in range(i+1):
print("*",end=" ")
print(" ")
for i in range(rows-1,0,-1):
for j in range(i):
print("*",end=" ")
print(" ")

OUTPUT

You might also like