You are on page 1of 3

#PYTHON MINI PROJECT <<120 MAX LINES T-T..

>>
#menu driven python program to show [SHAPES],to find[FACTORS],[HCF of 2 giver
number],[LCM of 2 giver number] and [FACTORIAL]
o=int(input("select an option :) \n 1.student \n 2.teacher \n 3.other \n Enter the
option number please : "))
if o == 1:
name=input("welcomeee ;0 Enter name : ")
print("welcome:) ","{<<",name,">>}","hope u got the correct options and answers
u wanted")
elif o == 2:
name=input("welcomeee ;0 Enter full name [all in lowercase] please : ")
if (('shanmuga') or ('priya')) in name:
print (" mam thankyou for all the teachings and supports that u have given
to us :) ... have a noice day mamm :o ")
else:
print ("welcomeeeee ... mr/mrs",name,"<<have a noice day>>")
elif o == 3:
name=input("welcomeee ;0 Enter name : ")
print("welcome:) ","{<<",name,">>}","hope u got the correct options and answers
u wanted....... have funnnnnn ;0")
else:
print("/&*%$^#@\input invalid T-T sry.. please run it again <not in loop> enter
[1 if student] or [2 if teacher] or [3 if other]/&*%$^#@*BUZZZ*")
#program storts.....
choice="yes"
while choice == "yes" :
option=int(input("Select the number :) \n 1.Shapes \n 2.Factors \n 3.HCF \n
4.LCM \n 5.Factorial \n Enter here please : "))
if option == 1 :
shape=int(input("select the shapes :) \n 1.Circle \n 2.Diamond \n 3.Right
angled triangle \n 4.Triangle \n 5.Square or rectangle \n Enter here please : "))
if shape == 1:
#<<CIRCLE>>
row=int(input("Enter the row value for the circle : "))
column=int(input("Enter the column value for the circle : "))
for i in range(0,row):
for j in range(0,column):
if((j == 0 or j == column-1) and (i!=0 and i!=row-1)):
print('*',end="")
elif( ((i==0 or i==row-1) and (j>0 and j<column-1))):
print('*',end="")
else:
print(end=" ")
print()
elif shape == 2:
#<<DIAMOND>>
num=int(input("Enter the number of rows : "))
for i in range(1,num+1):
print(" "*(num-i)+"* "*i)
for i in range(num,0,-1):
print(" "*(num-i)+"* "*i)
elif shape == 3:
#<<RIGHT ANGLED TRIANGLE>>
num=int(input("Enter the number of rows : "))
for i in range(1,num+1):
print("* "*i)
elif shape == 4:
#<<TRIANGLE>>
num=int(input("Enter the number of rows : "))
for i in range(1,num+1):
print(" "*(num-i)+"* "*i)
elif shape == 5:
#<<SQUARE OR RECTANGLE>>
num=int(input("Enter the number of rows : "))
for i in range(num):
for j in range(num):
print('*',end=" ")
print()
else :
print("Enter a valid option number")
elif option == 2:
# Program to find the factors of a number <<user defined function>>
def factors(x):
print("The factors of",x,"are:")
for i in range(1, x + 1):
if x % i == 0:
print(i)
num = int(input("Enter the number to find the factors: "))
factors(num)
elif option == 3:
# Python program to find H.C.F of two numbers <<user defined function>>
def hcf(x, y):
#only the smaller number
if x > y:
smaller = y
else:
smaller = x
for i in range(1, smaller+1):
if((x % i == 0) and (y % i == 0)):
hcf = i
return hcf
# To make your functions send Python objects back to
the caller code
num1 = int(input("Enter the first number to find HCF : "))
num2 = int(input("Enter the second number to find HCF : "))
print("The H.C.F. is", hcf(num1, num2))
elif option == 4 :
# Python Program to find the L.C.M of two number <<user defined function>>
def lcm(x, y):
# only the greater
if x > y:
greater = x
else:
greater = y
while(True):
if((greater % x == 0) and (greater % y == 0)):
lcm = greater
break
greater += 1
return lcm
# To make your functions send Python objects back to
the caller code
num1 = int(input("Enter the first number to find LCM : "))
num2 = int(input("Enter the second number to find LCM : "))
print("The L.C.M. is", lcm(num1, num2))
elif option == 5 :
#Program to find the factors of a number
num=int(input("Enter the number to find the factors of a number : "))
ans=1
i=1
while i<=num:
ans=ans*i
i=i+1
print("Factorial of",num,"is",ans)
else :
print("Enter a valid option number")
choice=input("wanna continue <yes or no> :")
if "o" or "O" in choice :
print("Program is closingg....")
print("Thankyou for your time :) hope you enjoyed it !!!:O")

You might also like