这是一项收集3项筹款活动数据并将其显示在表格中的任务,但我不断遇到此错误。您能确定错误是什么吗?
def get_activityName(list12l):
'''function to get the names of the activities'''
activity = input("Enter the name of your {0} activity: ".format(list12l))
while len(activity) > 10:
print("Enter a name under 10 characters long")
activity = input("Enter the name of your {0} activity: ".format(list12l))
return activity
def get_pricing():
'''this is the function that gets the hourly price for each activity'''
validPrice = "a"
while validPrice == 'a':
price = float(input("Enter the hourly charge for this activity: "))
if price > 5.99 or price < 0.99:
print("This is an invalid price. Enter a valid price.")
else:
validPrice = "b"
return price
def get_costs():
table = []
header = ['Activity, Charge per hour']
table.append(header)
list12l = ['first','second','last']
for x in range(0,3):
across = []
m = get_activityName(list12l[x])
n = get_pricing()
across.append(m)
across.append(n)
table.append(across)
return table
def printFinalTable(table):
for x,y in table:
print("\t{0}".format(x,y))
def main():
"""runs all functions"""
table = get_costs()
print('\n')
printFinalTable(table)
main()
答案 0 :(得分:0)
您的标题导致了此问题。应该是这个
...