Ok so if I wanted to do a simple while loop with a user inputting a number and a function doing some calculations, would it be possible to have it so that the user can type in 'quit' instead of a float if they want to quit? Thanks in advance.
xxxchopsakexxx
0
Newbie Poster
Recommended Answers
Jump to PostYes. You just check the lowercase input with 'quit'. Even easier is to quit by '' empty line as it acts as False in if statement. How ever it is easy to give aksidentaly.
Jump to PostKur3k that code will break because your exception handling is wrong.
The code dos not what what is ask for.
It check if an integer for odd/even and has no 'quit' check out.
The code example should like this to make sense.def check(number): if number % …
All 5 Replies
TrustyTony
888
pyMod
Team Colleague
Featured Poster
kur3k
-3
Light Poster
TrustyTony
888
pyMod
Team Colleague
Featured Poster
snippsat
661
Master Poster
HiHe
174
Junior Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.