Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
loop trouble
#4
def sub(testme):
    if len(testme) > 5:
        return 0
    else:
        return 1

def main():
    while True:
        ask = input("Write something (quit ends): ")  
        vastus = sub(ask)
        if ask == "quit":
            break        
        elif vastus == True:
            print("Too short")    
        else:
            print(ask)
            
    
if __name__ == "__main__":
        main()
got it Tongue
Reply


Messages In This Thread
loop trouble - by Jei - Dec-03-2016, 03:38 PM
RE: loop trouble - by stranac - Dec-03-2016, 04:17 PM
RE: loop trouble - by ichabod801 - Dec-03-2016, 04:17 PM
RE: loop trouble - by Jei - Dec-03-2016, 04:19 PM

Forum Jump:

User Panel Messages

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