From the course: Python for Non-Programmers
Unlock the full course today
Join today to access over 25,200 courses taught by industry experts.
Higher, lower, and polish - Python Tutorial
From the course: Python for Non-Programmers
Higher, lower, and polish
- [Instructor] We're going to keep improving our number guessing game here and we're going to start with the feature where we can tell the user they either need to guess higher or lower. So what we can do is inside of this while loop each time we're asking for a new guess we can use an if statement to check and see whether their guess was too high or too low. So we can say if guess is less than the correct number, in that case, they guess too low. So we need to tell them to guess higher. So we still want to do this line here that says that we want, the guess to be the result of an input and convert it into an int. But we want a message a little bit before guess that says maybe we'll say, "Wrong. You need to guess higher." because their guess was less than the correct number. So the else part of this and make sure this is tabbed on the same line as the if, we need to make sure that these two line up we're going to also…