Why does the loop start after I enter the first value for team A even though it's less than 15?

alex

Why does the loop start after I enter the first value for team A even though it's less than 15? After I enter the first value it doesn't go to the next loop where I am supposed to enter the value again until it reaches 15.

team_a = int(input("Please enter the score for team A: ")) 
team_b = int(input("Please enter the score for team B: "))  
team_a_score = 0 
team_b_score = 0 
Round = 0  
total_score = 15  

while total_score>team_a_score:

  team_a_score+=team_a 

  if total_score<team_a_score: 
  break 
print("the game is over")
Isem

Now you enter values only one time.
If you want to enter values in loop it should look like this:

team_a_score = 0 
team_b_score = 0 
Round = 0  
total_score = 15  

while total_score>team_a_score:
    team_a = int(input("Please enter the score for team A: ")) 
    team_b = int(input("Please enter the score for team B: "))  
    team_a_score+=team_a 

    if total_score<team_a_score: 
        break 
print("the game is over")

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

Why does my loop not stop, even though it's at the end?

why my loop will not stop even after i enter correct

Why does my print execute after the second loop even if I use print first?

Process starts after I call a function even though I try to start the process first

While loop gives values equal to, even though it explicitly states 'less than' not 'less than or equal to'

Why while loop closes after I enter new char value

Why does my linked list only contain one node even though I added more than one?

Why does cmd run my second command when I use && even though the first one failed?

Why does my program exit even though I spawn a task that should loop forever?

Why does my Xcode compiler tell me I use a value type even though I use classes?

Why does my d3 chart's x-axis include the first of every month as a tick even though I set the tick interval to every 7 days?

Why does the value in multiple CheckBoxList selected even though I specified one with the ID

Why does my while loop execute even though condition is not true?

Why does my program say the ArrayList element exists when I try to add it even though it's new?

Why does my pygame say it's not initialized even though I initialized it?

Why does the i in second loop counts as 1 less than the given input by the user?

Why do I have a deadlock even though it includes an endless loop?

Why does my Keras model train after I load it, even though I have not actually supplied any new training data?

Why does my division styling style 2 child elements even though i placed a first-child tag?

Why does `is` return False even though id's are identical?

Why does this produce an assertionerror even though it's exactly what was taught?

Why do I get 'use of uninitialized value' warnings even though I return a value from Try::Tiny's finally block?

Why does Angular duplicate the tag even though I used .replaceWith

Why does it stop even though I used continue?

why does pgeom n parameter value need to be one less than I expected?

Why object's value changes even though it has different references?

Why does Vue use it's “in-place patch”, though I'm binding a key in v-for loop?

Why is Forfiles recursing even though I'm not using the /S parameter?

Why Rust is faster than Ocaml in Performance, Even though first Rust compiler was implemented in Ocaml