9.8k views
2 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 LoneWolfPR
by
6.9k points

2 Answers

2 votes

Answer:

A set the variable to a beginning value

Step-by-step explanation:

Just did quiz

User Slawomir Chodnicki
by
6.6k points
4 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 Saurabh Ariyan
by
6.7k points