About 50 results
Open links in new tab
  1. do-while loop in python [SOLVED] | DaniWeb

    Python does not have a built-in do...while, but you can emulate "run at least once, then decide" cleanly. Use a boolean updated at the end of each iteration (avoid strings like "true"/"false", and prefer logical …

  2. python - Repeatedly asking for input | DaniWeb

    Dec 14, 2011 · A common, idiomatic way to keep asking the user for input is a sentinel-controlled loop: run forever and break only when the user asks to quit. Because True is always truthy, while True: …

  3. python - How to go back to a line of code...? [SOLVED] | DaniWeb

    Mar 26, 2011 · Python does not have goto; you structure control flow with loops and conditionals. To avoid being prompted twice, do not read the choice before the loop. Instead, print the menu once, …

  4. python - Converting celsius to fahrenheit using a ... [SOLVED] | DaniWeb

    The formatting options are documented in the Format Specification Mini-Language. If you prefer a different loop construct later, this logic translates directly to a for loop over a sequence; see Python’s …

  5. python - pygame window not werking [SOLVED] | DaniWeb

    Jan 4, 2009 · The fix is to keep the event queue flowing on the main thread. That is why code placed in a .py file with a simple loop appears to work while ad‑hoc REPL snippets often freeze. If you want to …

  6. python - Using string to check for a while loop. [SOLVED] | DaniWeb

    Recommended Answers Your program works fine in python 3.2, You do not need str in front of the user inputs, if something doesn't work in your code try using 'print' statements, like I have with your code …

  7. python - login program with loop | DaniWeb

    I have to make a login program where the username and password are taken from an existing file. I have successfully, in my opinion, opened, read, and ...

  8. Finding the largest and smallest numbers in python

    Nov 6, 2012 · In Python 3, input() returns a string. If you are using Python 2, use raw_input() instead. Relevant docs: min/max built-ins in Built-in Functions, exceptions in Errors and Exceptions, and …

  9. python - Loop through a year [SOLVED] | DaniWeb

    Two small improvements make this task simpler and more robust in modern Python. First, iterate with an end-exclusive boundary instead of guessing the number of days. This works for any year (leap or …

  10. python - Modifying this random word program [SOLVED] | DaniWeb

    Dec 5, 2008 · The while loop used to go through line 26 in previous versions of the code. The while loop starting on line 33 will keep looping until you get the right guess or enter a blank line, but the loop …