#π Need to repeat input multiple times before it gets registered
23 messages Β· Page 1 of 1 (latest)
@warm wedge
Remember to:
- Ask your Python question, not if you can ask or if there's an expert who can help.
- Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
- Explain what you expect to happen and what actually happens.
:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.
You probably sent a file in your message, the bot doesn't like that :p
!paste read the embed for sharing your code
If your code is too long to fit in a codeblock in Discord, you can paste your code here:
https://paste.pythondiscord.com/
After pasting your code, save it by clicking the Paste! button in the bottom left, or by pressing CTRL + S. After doing that, you will be navigated to the new paste's page. Copy the URL and post it here so others can see it.
yeah just saw that
will put it through the link its telling me
https://paste.pythondiscord.com/RVRQ like this?
Basically, i'm having issues in my code near the end, where i promt the user to input r or q to either restart or quit the program. Restart works fine, but quit doesn't. I need to type q a few times before it quits, and i don't have much of a clue as how to fix this.
Can you try using exit(0) instead of os._exit(0)? The latter is kinda weird and might be doing some unusual stuff
Nevermind that's not the problem
You are not saving the input, you are asking for an input 4 times in that last loop.
try something like clear_cmd = 'cls' if os.name == 'nt' else 'clear' btw. then you can just do os.system(clear_cmd)
So you will have to input something up to 4 times.
π
If you want to check if someone entered the letter r or R you can either do if input_variable in 'rR': or if input_variable.casefold() == 'r':
!d str.casefold
str.casefold()```
Return a casefolded copy of the string. Casefolded strings may be used for caseless matching.
Casefolding is similar to lowercasing but more aggressive because it is intended to remove all case distinctions in a string. For example, the German lowercase letter `'Γ'` is equivalent to `"ss"`. Since it is already lowercase, [`lower()`](https://docs.python.org/3/library/stdtypes.html#str.lower) would do nothing to `'Γ'`; [`casefold()`](https://docs.python.org/3/library/stdtypes.html#str.casefold) converts it to `"ss"`.
The casefolding algorithm is [described in section 3.13 βDefault Case Foldingβ of the Unicode Standard](https://www.unicode.org/versions/Unicode15.0.0/ch03.pdf).
Added in version 3.3.
This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.