+ 2
How to replace multiple words in a phrase in python using replace() function?
24 odpowiedzi
+ 2
Shadoff
And one thing you are not a determiner to say to delete my question
+ 4
You can do this using for loop:
https://code.sololearn.com/ca734a4A6A14
There are also other ways of doing this.
Here is the resource:
https://stackoverflow.com/questions/6116978/how-to-replace-multiple-substrings-of-a-string
+ 1
use replace function multiple times
+ 1
Is there any other short way
+ 1
Also I hope you know about lower(), isalpha(), isdigit() functions?
which are useful when working with the strings
+ 1
Buddy, you need to finish python core course then
+ 1
Python core, python intermediate
+ 1
没事, 都是可以。但是,最好 如果 你开始 python core, 然后python intermediate
+ 1
YOU HAVE A LOT ROADS TO WALK OUT. it was just a test.
And you didn't pass it.
Let me give you a free advice.
Google, and Google translate is your friends!
This thread is not program related anymore. Please delete your Question
+ 1
Madhav Nandhi Vardhan Appana
I would suggest you learn Python Intermediate, then Python Core.
You will find a lot of the lessons in Core are repeats of the previous lessons, but it will make for good revision.
Do you have a concept / code to show of what you are trying to achieve with your original post.
There may be a number of ways to achieve the result if a clear example is given
+ 1
Madhav Nandhi Vardhan Appana
Awesome!
Take your time and restructure your attempt.
When you are ready, post your attempt here & we will be able to see where your problem is (hopefully)
Then we should be able to guide you to a resolution.
I seem to remember there was a trick involving 10 in the challenge, you may need to read the challenge carefully.
Let us know how you get on.
+ 1
Here's a possibility:
repl = {"C": "low", "python": "high2", "Java": "high1"}
sent = input()
for x in repl: sent = sent.replace(x, repl[x])
# More words may be added
# Hope this helps
+ 1
Calvin Thomas
Thank you for your answer
+ 1
The only solution to this is by using a loop
0
yes.
you can use predefined dictionary in the user defined function.
which will take as an argument string, and returns new string where:
all words in the dictionary keys will be replaced with the dictionary's value.
got it?
0
I will try it
Thank you for your answer.
0
No I don't know
But I will learn them
0
I had completed python for beginners course ,
What should I have to complete now
0
Which one i have to complete first
0
Python core or Python intermediate