Note that there are some explanatory texts on larger screens.

plurals
  1. POWhile loops in a program running
    primarykey
    data
    text
    <p>I have this program that I am writing and I want it to quit.</p> <p>Meaning, when I type in <code>Q</code>, or give it an input of <code>Q</code>, it should show me..</p> <pre><code>Press Q to quit: Q And it should show &gt;&gt;&gt; in next line </code></pre> <p>But so far I have: </p> <pre><code>list = ['Approval', 'Range', 'Plurality', 'IRV', 'Borda', 'Q'] input_prompt = prompt_from_list('Select a voting system or Q to quit:', list) while input_prompt != 'Q': approval_file = open(APPROVAL_BALLOT_FILENAME, 'r') approval = approval_file.readlines() approval_file.close() if input_prompt == 'Approval': print('Running for Approval') prompt_riding = prompt_for_riding("Which riding would you like to see results for? (Enter a number between 0 and 307, or all.):", 307) list = format_approval_list(approval, prompt_riding) a = vs.voting_approval(list) country = print_country_results(a[1]) elif input_prompt == 'Range': print('Running for Range') prompt_riding = prompt_for_riding("Which riding would you like to see results for? (Enter a number between 0 and 307, or all.):", 307) print prompt_riding </code></pre> <p>Now it should continue the loop.. for after the we input prompt and it should go to prompt_riding, but it doesnt...:(</p> <pre><code>&gt;&gt;&gt;Select a voting system or Q to quit: Approval, Range, Plurality, IRV, Borda, Q Approval Running for Approval Which riding would you like to see results for? (Enter a number between 0 and 307, or all.):0 Which riding would you like to see results for? (Enter a number between 0 and 307, or all.): It should show me.. Select a voting system or Q to quit: Approval, Range, Plurality, IRV, Borda, Q </code></pre> <p>Is there a possible way I can close the infinite while loop?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload