Problemas
this code has 5 syntax errors! Find them and correct them. When you have found and corrected all five, run the program and verify that it works.You can change the initial score # to test different outcomes of the program. Create a variable called score, setting it to 10 score=10 If the score is zero or less 10-if scor <= 0: Output to the user that they lose print("You Lose!) : Output - You Min!- and the score to the user print("You Win!") prnit("Your score is: ") print (score) Mish the user good luck next time (If they win AND if they lose) print("Good luck next time.")
Solución
Ana Paulamaestro · Tutor durante 5 años
Verificación de expertos
4.2 (117 votos)
Responder
Here is the corrected code with the five syntax errors fixed:<br /><br />```python<br /># Create a variable called score, setting it to 10<br />score = 10<br /><br /># If the score is zero or less<br />if score <= 0:<br /> # Output to the user that they lose<br /> print("You Lose!")<br /> <br /># Output - You Win! - and the score to the user<br />print("You Win!")<br />print("Your score is:", score)<br /><br /># Wish the user good luck next time (If they win AND if they lose)<br />print("Good luck next time.")<br />```<br /><br />Explanation of the corrections made:<br />1. Changed `: Create a variable called score, setting it to 10` to `# Create a variable called score, setting it to 10` to convert the comment to a Python comment.<br />2. Changed `$score=10$` to `score = 10` to use proper Python variable assignment.<br />3. Changed `10-if scor <= 0:` to `if score <= 0:` to fix the indentation and use the correct variable name.<br />4. Changed `print("You Min!")` to `print("You Win!")` to correct the typo.<br />5. Changed `print (score)` to `print("Your score is:", score)` to provide the correct output format.<br />6. Changed `prnit("Good luck next time.")` to `print("Good luck next time.")` to correct the typo.
Haz clic para calificar: