我在做作业,看起来像这样:def main():
keep_going = 'y'
number_of_salespeople = 0
while keep_going == 'y' or keep_going == 'Y':
process_sales()
number_of_salespeople += 1
keep_going = input('Are there more salespeople? (enter y or Y for yes) ')
print(' ')
print('There were', number_of_salespeople, 'salespeople today.')
def process_sales():
print(' ')
name = input('What is the salesperson\'s name? ')
first_sale_amount = float(input('What is', name, '\'s first sale amount? '))
while 0 <= first_sale_amount <= 25000:
print('Error: that is not a valid sales amount. The amount must be greater than 0')
first_sale_amount = float(input('Please enter a correct sale amount: '))
highest_sale = first_sale_amount
lowest_sale = first_sale_amount
average_sale = first_sale_amount
number_of_sales = float(input('How many sales did', name, 'make this month? '))
for number in range(2, number_of_sales + 1):
sale_amount = float(input('Enter', name, '\'s time for sale #' + str(number) + ': '))
while 0 <= sale_amount <= 25000:
print('Error: that is not a valid sales amount. The amount must be greater than 0')
sale_amount = float(input('Please enter a correct sale amount: '))
if sale_amount > highest_sale:
highest_sale = sale_amount
else sale_amount < lowest_sale:
lowest_sale = sale_amount
total_sales += sale_amount
average_sale = (first_sale_amount + total_sales) / number_of_sales
print('The highest sale for', name, 'was', \
format(highest_sale, ',.2f'), \
sep='')
print('The lowest sale for', name, 'was', \
format(lowest_sale, ',.2f'), \
sep='')
print('The average sale for', name, 'was', \
format(average_sale, ',.2f'), \
sep='')
main()
我的错误在if-else语句的底部
^{pr2}$
错误如下:Syntax Error: else sale_amount < lowest_sale:: , line
58, pos 24
我看不出问题出在哪里,谁能帮我弄清楚错误是从哪里来的吗。谢谢你的帮助。在