427,796 views
16 votes
16 votes
Ying sends a program to a colleague for help in debugging it. The following message is returned: “You forgot to initialize the variable for the number of attempts.” How should this problem be fixed? (QUICK!!)

User Loke
by
2.6k points

2 Answers

24 votes
24 votes

Answer:

A set the variable to a beginning value

Step-by-step explanation:

Just did quiz

User Michilus
by
3.2k points
16 votes
16 votes

Answer:

To fix this problem, the variable for the number of attempts should be initialized with a starting value, such as 0 or 1. This can be done by adding a line of code at the beginning of the program that assigns a value to the variable, like this:

attempts = 0 # Initialize variable for number of attempts

User Zander Rootman
by
3.0k points