Question: How can I make this code an infinite loop that prints out an output before each new loop starts import sys print ( Invoice
How can I make this code an infinite loop that prints out an output before each new loop starts
import sys
printInvoice
printColumbus State University"
print University Ave."
printColumbus GA
print
invalidinput True
def getstudentinfo:
#Prompts the user for student details and validates input until valid data is provided.
invoice inputDo you need to create an invoice Y or N
if invoice in N:
printHave a good day!"
sysexit
while True:
name inputEnter student name:
if name.strip:
break
printInvalid name. Please enter a name."
enterAddress inputEnter your address:"
enterLocation inputEnter your city, state, and zip code:"
print
printname
printenterAddress
printenterLocation
print
while True:
studenttype inputAre you a undergraduate or graduate U or G: upper
if studenttype in UG:
break
printInvalid student type. Please enter U or G
while True:
try:
credithours intinputEnter credit hours:
if credithours if studenttype Y else credithours :
break
printInvalid credit hour range. Please enter between and Undergraduate or and Graduate
except ValueError:
printInvalid input. Please enter a number."
while True:
tuitionstatus inputAre you instateIOutofStateOor OutofCountryC:upper
if tuitionstatus in IOC:
break
printPlease enter IOor C
while True:
onlineclass inputAre you taking any online classesY or N:
if onlineclass in YN:
break
printInvalid answer. Please enter Y or N
while True:
militarystatus inputAre you in the militaryY or N:
if militarystatus in YN:
break
printInvalid answer. Please enter Y or N
return name, studenttype, credithours, tuitionstatus
def calculatetuitioncredithours, tuitionstatus, studenttype:
#Calculates tuition based on credit hours, tuition status, and student type.
if studenttype U:
percreditcost I: O: C:
if credithours :
return percreditcosttuitionstatus
else:
return credithours percreditcosttuitionstatus
else:
percreditcost I: O: C:
if credithours :
return percreditcosttuitionstatus
if onlineclass Y:
return tuitionamount
if militarystatus Y:
return fixedfees
else:
return credithours percreditcosttuitionstatus
invalidinputinvoice True
def printinvoicename studenttype, credithours, tuitionstatus, tuitionamount, fixedfees:
#Prints the invoice with calculated details.
print
printColumbus State University Invoice"
printStudent Type:", studenttype
printCredit Hours:", credithours
printTuition Status:", tuitionstatus
printTuition Amount:", tuitionamount
printFixed Fees:", fixedfees
printTotal Amount:", tuitionamount fixedfees
print
if namemain:
fixedfees # Sum of all fixed fees
studentinfo getstudentinfo
name, studenttype, credithours, tuitionstatus studentinfo
tuitionamount calculatetuitioncredithours, tuitionstatus, studenttype
printinvoicename studenttype, credithours, tuitionstatus, tuitionamount, fixedfees
while invalidinput:
getstudentinfo
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
