0% found this document useful (0 votes)
41 views3 pages

Finx

The document contains code for a Python program that uses while loops and conditional statements. The program allows the user to choose between different options like a calculator, checking if a number is even or odd, or checking if a number is positive or negative. Based on the user's choice, it will run the corresponding code block to perform the chosen task. It also has options to rerun the program or quit after each iteration.

Uploaded by

Mikkos Atas
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
41 views3 pages

Finx

The document contains code for a Python program that uses while loops and conditional statements. The program allows the user to choose between different options like a calculator, checking if a number is even or odd, or checking if a number is positive or negative. Based on the user's choice, it will run the corresponding code block to perform the chosen task. It also has options to rerun the program or quit after each iteration.

Uploaded by

Mikkos Atas
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

answer=True

while answer == True:


print ("Choices: " )
print ("(a)calculator" )
print ("(b)even or odd" )
print ("(c)positive or negative number" )

choice=input("Enter your choice? ")


if choice=="A" or choice=="a":
fname = input("Enter your First name:")
mname = input("Enter your Midlle name:")
lname = input("Enter your Last name:")
time = input("Is it am or pm:")
if time == "am":
print("Good morning,", fname, mname, lname,"!" "Have a great day ahead! ")

else:
print("Good night", fname, mname, lname,"!" "You deserve to take some rest! ")

elif choice=="B" or choice=="b":


name=input ("enter your name:")
math=int(input("enter your grade in math:"))
filipino=int(input("enter your grade in Filipino:"))
english=int(input("enter your grade in English:"))
science=int(input("enter your grade in Science:"))
PE=int(input("enter your grade in P.E:"))
gwa=(math+filipino+english+science+PE)/5
print(str(name) +", this is your GWA "+str(gwa))
if gwa== 100:
print("You got an Excellent grade! ")
elif gwa>=90 and gwa<99:
print("You got an Very Good grade! ")
elif gwa>=80 and gwa<89:
print("You got an Satisfactory grade! ")
elif gwa>=70 and gwa<79:
print("You got an Passed grade! ")
else :
print("You got an Failed grade! ")
elif choice=="C" or choice=="c":
n = int(input("Enter a number: "))
for i in range(n):
for j in range(n-i-1) :
print (" " ,end="")
for j in range(i+1) :
print ("*" ,end=" ")
print()

else :
print("Invalid Input!")
answer=input("Do you want to try again?[Y/N]: ")
if answer=="N" or answer=="n":
print ("Thank you! ")
answer=False
elif answer=="Y" or answer=="y":
print ("Thank you! ")
answer=True

else:
print("Input was not valid! ")

answer=True
while answer == True:
print ("Choices: \n 1 – Python Variables and Constants \n 2 – Python Arithmetic
Operators with Conditional Statements \n 3 – Python Looping Statements" )

choice=input("Enter your choice? ")


if choice=="1":
fname = input("Enter your First name:")
mname = input("Enter your Midlle name:")
lname = input("Enter your Last name:")
time = input("Is it am or pm:")
if time == "am":
print("Good morning,", fname, mname, lname,"!" "Have a great day ahead! ")

else:
print("Good night", fname, mname, lname,"!" "You deserve to take some rest! ")

elif choice=="2":
name=input ("enter your name:")
math=int(input("enter your grade in math:"))
filipino=int(input("enter your grade in Filipino:"))
english=int(input("enter your grade in English:"))
science=int(input("enter your grade in Science:"))
PE=int(input("enter your grade in P.E:"))
gwa=(math+filipino+english+science+PE)/5
print(str(name) +", this is your GWA "+str(gwa))
if gwa== 100:
print("You got an Excellent grade! ")
elif gwa>=90 and gwa<99:
print("You got an Very Good grade! ")
elif gwa>=80 and gwa<89:
print("You got an Satisfactory grade! ")
elif gwa>=70 and gwa<79:
print("You got an Passed grade! ")
else :
print("You got an Failed grade! ")
elif choice=="3":
n = int(input("Enter a number: "))
for i in range(n):
for j in range(n-i-1) :
print (" " ,end="")
for j in range(i+1) :
print ("*" ,end=" ")
print()

else :
print("Invalid Input!")
answer=input("Do you want to try again?[Y/N]: ")
if answer=="N" or answer=="n":
print ("Thank you! ")
answer=False
elif answer=="Y" or answer=="y":
print ("Thank you! ")
answer=True

else:
print("Input was not valid! ")

You might also like