Sololearn question | Sololearn: Learn to code for FREE!
¡Nuevo curso! ¡Todo programador debería aprender IA Generativa!
Prueba una lección gratuita
+ 1

Sololearn question

Hi guys there is one of the sololearn Practice can you help me. If input is like (I want 1 apple) The out put has to be like (I want one apple) I know how to make 1 to one but how to undrestand it is first of the sentence or end of that or in the middle of that i mean how can i undrestand the place of number?

19th Dec 2023, 5:47 PM
Fateme Biglari
Fateme Biglari - avatar
3 Respuestas
+ 2
You could use the find method. user_input = input() index = user_input.find("1") For more complex cases you could use RegEx (regular expression) like here. https://www.w3schools.com/JUMP_LINK__&&__python__&&__JUMP_LINK/python_regex.asp https://www.sololearn.com/learn/o-Python/2475/?ref=app
19th Dec 2023, 7:11 PM
Stefanoo
Stefanoo - avatar
+ 4
Fateme Biglari Can you share your code attempt here so we can see your concept. We can then help you build your understanding on code you already understand
20th Dec 2023, 1:20 AM
Rik Wittkopp
Rik Wittkopp - avatar
+ 3
Can use loops and membership operators
21st Dec 2023, 5:46 AM
Jyotsana
Jyotsana - avatar