Linked Questions

-5 votes
1 answer
4k views

I need this for my homework. I'm trying to create a a program where I ask the user for some words. I want those words to be on a list so then I can use .index to call some. I tried to use .set or ...
Iv Ramírez's user avatar
-3 votes
3 answers
662 views

I have a string and I want to split it based on word match. How can I do that? Here is my incomplete attempt text_ = "Sky is beautiful today" test = "beautiful" if test in text_: ...
itsMe's user avatar
  • 785
-8 votes
2 answers
2k views

I am trying to solve a problem where I need to get every word in the sentence and sort it alphabetically. I would really appreciate some help in the matter, as I don't quite have a clue about how to ...
ron zamir's user avatar
0 votes
1 answer
594 views

I'm new to python and I'm trying to take words in a string and put them into a list, but I'm having trouble. This is what it should look like: Input: sentence = "abcde that i like." Output: ...
Thromobocytin's user avatar
0 votes
4 answers
382 views

I want to be able to print the whole variable, or just detect it. If I run it through a for loop as I've done in the code below, it just prints the individual letters. How can it print the whole word? ...
Alexhs's user avatar
  • 13
-1 votes
2 answers
58 views

Is there a way in python to extract each substring thats inside a string? For example if I have the string "Hello there my name is Python" I want to take out each sub-string (or individual word) ...
slowjoe44's user avatar
0 votes
0 answers
44 views

This is quite a simple task but I'm not sure how to do it correctly and efficiently. What I want is the user to enter some strings and to convert those str into values of a list Example: input: "...
BobEk's user avatar
  • 21
46 votes
7 answers
149k views

I wanted to know how to iterate through a string word by word. string = "this is a string" for word in string: print (word) The above gives an output: t h i s i s a s t r i n g But ...
m0bi5's user avatar
  • 9,506
0 votes
5 answers
4k views

Sentence = "the heart was made to be broken" How to split sentence for displaying in separate lines by using Python? (4 words per line) Line1: the heart was made Line2: to be broken Any advice?
ThanaDaray's user avatar
  • 1,703
1 vote
4 answers
3k views

I'm new to Python but here is the question Given a string, write a program to return the sum and average of the numbers that appear in the string, ignoring all other characters. Input The input will ...
pran's user avatar
  • 11
1 vote
2 answers
2k views

I want to have a good pattern matching code which can exactly match between both strings. x = "Apple iPhone 6(Silver, 16 GB)" y = "Apple iPhone 6 64 GB GSM Mobile Phone (Silver)" Approach 1: ...
John Dene's user avatar
  • 580
-2 votes
2 answers
1k views

I wan to create a function which, when given a sentence and a letter, returns a list containing all words in the sentence with the said letter. I want to use a list comprehension to return the list. ...
user10019227's user avatar
1 vote
3 answers
709 views

I have a list of words: words = ['ABC', 'CDE', 'EFG'] How to check that my string only consists words from that list? For example, 'EFG CDE' results True since both 'CDE' and 'EFG' are in words. My ...
sim's user avatar
  • 488
0 votes
1 answer
1k views

Hi senior users of python, and thank you for reading this through. I am currently trying to program an accounting application that can read and write files for users. I have a bit of trouble when ...
Jamesong7822's user avatar
-1 votes
5 answers
1k views

how do i get 1st word of each string in the list and create a new list. list1 = ['GenX XE','GenX XM','GenX XT','GenX XMA','GenX XTA'] # this is my my list n= len(list1) for i in range(n): ...
prapul r's user avatar

15 30 50 per page