0

I'm trying to have the user enter their name and client stock profit information for as many clients as the user wants.The loop will go around until the user answers no for if they have another client they want to enter. Then it will print the average of all the clients stock information. I'm just not sure how to get the loop to stop properly and execute the rest of the code.

csum=0
ccount=0
clients=int(input("How Many Clients?"))
while clients==clients:
    sum=0
    counter=0
    determiner=str(input("Do you have another client to enter?"))
    clientname=str(input("What is the client's name?"))
    if determiner==str('Yes' or "Y" or "YES"):
        for i in range(4):
            stock=int(input("Enter Stock Amount:"))
            sum=sum+stock
            counter=counter+1
            avg=sum/counter
            csum=csum+avg
            ccount=ccount+1
    print("The Average for",clientname,"is:",avg)
    elif determiner==str('No' or 'no' or 'NO'):
        cavg=csum/ccount
        print("The average for all the clients is:",cavg)
  • The `elif` has to be _directly_ after the `if` block; you can't have a `print` between them. – Charles Duffy Oct 03 '22 at 23:58
  • `str('Yes' or "Y" or "YES")` doesn't do what you think it does. Open up a python interpreter and try `print(str('Yes' or "Y" or "YES"))` – Paul H Oct 04 '22 at 00:09

0 Answers0