This question already has an answer here:
Hello and thank you for taking the time out of your day to look at my question. I'm working on an assignment that will calculate the total of a number of bottles from user input. I have the code mostly working properly. But, we are also supposed to have the user redirected if they input a negative or alphabetic number. I've tried implementing some if statements and other conditional statements but still haven't quite got what I'm looking for. I think the portion of the code I've provided is where the user will be redirected if they input an invalid input. I can be provided further clarifications if needed. As this is my first time posting on StackOverflow. Even just a general hint would beneficial :)
def Bottles2(bottles, bottles_each_day, counter): while counter <= 7:
bottles_each_day = input("enter total bottles returned for the seven days ")
bottles_each_day = (bottles_each_day)
bottles += int(float(bottles_each_day))
counter = (counter + 1)
return bottles
Aucun commentaire:
Enregistrer un commentaire