#๐ Begginer
47 messages ยท Page 1 of 1 (latest)
@abstract arrow
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.
!code
as told
how do i do that
npty wants you to paste in what code you have so far, between ```py and ``` code fence lines.
You put the link that generated if you used pastebin
Yes, sorry, fixed. Just keyboard brain off moment.
ok so i know some of the basics not all of them
first, do you know how to split according to space?
idk how to split the names so i recieve only the initials
follow me step by step
ok
That takes 2 steps: split the string up, and then take the first character from each substring.
do you know how to do this
no
!doc str.split
str.split(sep=None, maxsplit=-1)```
Return a list of the words in the string, using *sep* as the delimiter string. If *maxsplit* is given, at most *maxsplit* splits are done (thus, the list will have at most `maxsplit+1` elements). If *maxsplit* is not specified or `-1`, then there is no limit on the number of splits (all possible splits are made).
If *sep* is given, consecutive delimiters are not grouped together and are deemed to delimit empty strings (for example, `'1,,2'.split(',')` returns `['1', '', '2']`). The *sep* argument may consist of multiple characters as a single delimiter (to split with multiple delimiters, use [`re.split()`](https://docs.python.org/3/library/re.html#re.split)). Splitting an empty string with a specified separator returns `['']`.
For example:
Your full_name variable contains a string, so it has a .split() method (because it's a string, type str).
ok im following
so, what would you do after reading that?
Got an interactive prompt handy? The >>> prompt for Python's interactive mode?
after every first letter split it from the rest? right?
you split the entire input to a list of word, and get the initial for each item from the list
you learn this on how to seperate a string to a list of sub-string
no i didnt
i don't think the textbook went over that
so im kind of lost on that part
we on't know what you learnt
but we just taught you this
we couldn't guess what you have learnt
so after each space am i splitting the names up?
you either tell us what you have learn, or we would suggest you to use that that we have taught you
for example if i were to use this would it work py name_parts = full_name.split()
yes
oh ok ok
This help channel has been closed. 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.