Question
Python. My program I feel is very close to being finished but I keep find errors then those create more errors. Right now my program
Python. My program I feel is very close to being finished but I keep find errors then those create more errors. Right now my program isn't going through to the next steps once entering the inputs numbers in the while True statement. The end result of this program should give you the Total nut sales quantity,average, grand total sales amount of all troops and the maximum of nut sales. The last error I found was
line 15, in
nuts=float(input())
ValueError: could not convert string to float: ''
How do I fix the error in line 15 to convert string to float?
Then what would be the next step into getting my program to acknowledge the print functions in the end?
#Beginning
while True:
print("(To end loop enter -2001) How many troops will you be entering:")
Num_troops=float(input())
if Num_troops==-2001:
print('The loop has ended. Thank you.')
break
#Finding maximum and sum with nested loop
sum=0
max_troops=0
nuts=float(input())
if nuts>=1:
sum=sum+nuts
if max_troops
max_troops=nuts
#Caculating Average nut sales
average=sum/Num_troops
#Total nut sales quantity,average, grand total sales amount of all troops
#cost per bag is $15
print("Total of all nut sales(quantity):",sum)
print("The grand total of all nut sales:$",sum*15.0)
print("Highest girl scout amount of cookies sold : ",max_troops*15.0)
print("Highest girl scout Quantity of cookies sold : ",max_troops)
print("Avarage of troop nut sales :",avarage)
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started