Python Forum
repeated statements when using for and if
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
repeated statements when using for and if
#2
There's lots of errors in the formatting of the code you have posted (spaces where they shouldn't be, spaces missing)
There is also undefined variables.
When asking for help please post a minimal code sample that is able to be run.

You could create a variable before the loop book_found = False
Add book_found = True to the end of the if statement
Remove the
elif
statement
After the loop add
if not book_found:
     print ("no books in that interval")
Reply


Messages In This Thread
RE: repeated statements when using for and if - by Yoriz - Mar-29-2019, 03:22 PM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020