#π RPG Character Builder - capitalization
89 messages Β· Page 1 of 1 (latest)
@velvet prairie
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.
!e
print("SoMe wEird String".capitalize())```
@plush meadow :white_check_mark: Your 3.12 eval job has completed with return code 0.
Some weird string
!e
print('lMaO lOoooL'.title())
@barren pasture :white_check_mark: Your 3.12 eval job has completed with return code 0.
Lmao Looool
these are allowing me to output the properly capitalized thing, but my list has all lower case entries that it checks inputs against for match .. currently, it loops if you input 'Human' where 'human' is expected
sorry .. i know im saying all of this wrong
!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.
sidetrack: are these links safe https://paste.pythondiscord.com/MWDQ
im pretty new to discord usage in general haha
how do i make sure these links are safe?
The pythondiscord pastebin links?
yeah
!paste
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.
^
You can ask in #python-discussion maybe
Oh it's just a pastebin
some people paste some ratchet stuff though
As long as you don't download it and run it you're fine
maybe you can try converting the user input to either casefold as suggested or lower case before checking against the strings in your 'races' list?
apologies for the side track
just back, reading
how can i end a running program in vscode?
its wrongly looped somehow and wont let me out lol
nm i got it
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.
paste it again its empty
where are you getting the inf loop?
All that I require from you is a yes or no answer.
that print
i have to ctrl+c to interrupt it
its calling out line 102 and 34 but idk why
it only breaks if i input something other than yes_ or no_answers
sorry that was probably helpful 5min ago
like when it asks "will you allow fate ... ?" if you answer "hippo" it infiniteloops that print
add a 'break' below print('All that I require from you is a yes or no answer.')
that still loops
i, michael, swear on everything holy, that my code is pure and true
lmao
i wouldnt be able to send you spicy code if i tried rn
think i got it
hahahah no worries i looked at your code there's nothing wrong
i mean
in terms of... bad code
i got the solution i think
i moved the sex_test input into the while True loop in the fate_sex function
the else loop for "all i require..." is moved one indent to the left, in line with "if sex_test in answers" (line 17), just in case u didn't notice
@velvet prairie lmk it works for u
π
added traits functionality .. i feel like its the woirst way to do it and there is some way you woulda done it in 3 lines :P https://paste.pythondiscord.com/TZEQ
you could do something along the lines of
get the index of the effective_race using races.index(), then pass in that index into pt and bt
and then return trait1 and 2
this is with assumption your order of elements in races is always consistent with the order in pt and bt
!e
races = [ 'dwarvan', 'elvan', 'gnoman', 'goblan',
'halvan', 'human', 'northman', 'orcan']
pt = ['a beard', 'pointed ears', 'a bald head', 'greenish skin', 'hairy feet', 'an unremarkable appearance', 'blonde hair', 'lower tusks']
bt = ['stonewise', 'swift of though & action', 'a tinker', 'cunning', 'silent', 'talented', 'quick to rage', 'intimidating']
effective_race = 'elvan'
effective_race_idx = races.index(effective_race)
trait1, trait2 = pt[effective_race_idx], bt[effective_race_idx]
print(trait1, ", ", trait2)
@barren pasture :white_check_mark: Your 3.12 eval job has completed with return code 0.
pointed ears , swift of though & action
not working as is
not sure what i did wrong
oh i got it
since i used capitalize
i had to capitalize the races
ok so the next question i have is a doozy
right now, both recessive traits are displayed
i would like it so that each recessive trait has a 25% chance of occurring
i had this coded in another thing, but it looks totally different now, and i dont know how to go about thinking about how to do it
like i want to do a if statement in the middle of the format displays, but idk if i can or how
there is probably a better way
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.
π RPG Character Builder - capitalization