Python Forum
While loop to run a boolean test
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
While loop to run a boolean test
#7
(Nov-16-2018, 09:54 AM)vicson Wrote:
(Nov-16-2018, 09:49 AM)buran Wrote: Sorry, item 2 in my list is not correct, please ignore it. I didn't see that you have return True at the end of your function.
As to item 1 - just add a line, in the while body, that changes result after user input

Hi, I have added a line that changes the result. However I still face the same problem can't exit the while loop..

    result = isValidStudentIDFormat(stid) 
    while (result != True):
        print("Invalid student id format. Please check and enter again.")
        stid = input("Enter student id: ")
        result == True

sorry I don't get it. Isn't result a variable for isValidStudentIDFormat? Aren't they the same thing?
sorry I am a newbie to programming...
Reply


Messages In This Thread
While loop to run a boolean test - by vicson - Nov-16-2018, 08:33 AM
RE: While loop to run a boolean test - by buran - Nov-16-2018, 08:49 AM
RE: While loop to run a boolean test - by vicson - Nov-16-2018, 09:39 AM
RE: While loop to run a boolean test - by buran - Nov-16-2018, 09:49 AM
RE: While loop to run a boolean test - by vicson - Nov-16-2018, 09:54 AM
RE: While loop to run a boolean test - by vicson - Nov-16-2018, 10:27 AM
RE: While loop to run a boolean test - by buran - Nov-16-2018, 10:13 AM
RE: While loop to run a boolean test - by buran - Nov-16-2018, 11:07 AM

Forum Jump:

User Panel Messages

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