#๐Ÿ”’ Extracting only words that begin with a Capital.

28 messages ยท Page 1 of 1 (latest)

coarse stirrupBOT
#

@gray ice

Python help channel opened

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.

placid hull
#

!e
``py

coarse stirrupBOT
#

@placid hull :warning: Your 3.12 eval job has completed with return code 0.

[No output]
placid hull
#

oops

#

!e

sentence = "You and I visited the Big Ben."

only_caps = list(filter(lambda word: word[0].isupper(), sentence.split()))
print(only_caps)
coarse stirrupBOT
#

@placid hull :white_check_mark: Your 3.12 eval job has completed with return code 0.

['You', 'I', 'Big', 'Ben.']
gray ice
#

Sorry the list I'm pulling from is a .txt file I named modified

austere bloom
#

''.join() concatenates the modified list into one single string

#

it should work if you just remove it and use just modified?

gray ice
#

I'll give it a shot

ember blaze
austere bloom
gray ice
#

right.

#

I changed it to

#
print(only_caps)```
austere bloom
#

you mean you copy pasted Tathya's?..

gray ice
#

I did, and then added in modified for my list name.

austere bloom
#

it'll probably error, but if it does
think for a bit about why, at least this little you should be able to figure out on your own

placid hull
gray ice
#

It's a log file

#

a .txt

austere bloom
#

they mean it not just conceptually, but rather what is it type in python in practice
(list, string, something else)

gray ice
#

it's a list.

placid hull
#

you cant split a list using .split()

gray ice
#

Thanks for the help guys, I'm going to keep messing around with things till something works.

coarse stirrupBOT
#
Python help channel closed

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.

#

๐Ÿ”’ Extracting only words that begin with a Capital.