Looking for a Function | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Looking for a Function

Hello everyone who is reading ✋🏼. I am looking for a function that would be able to store each one by one. I explain myself. I’ve got « O * 2 * 3 * 4 », I need my iterator as soon as he meets ‘*’ he stores the item before as an argument. So 0 , 2 , 3 , 4 are different item

11th Mar 2019, 10:05 AM
Siyam
Siyam - avatar
2 Answers
+ 3
The method 'split' that type str comes with, splits a string by space by default, but you can define another split sign. inp = input() list_ = inp.split('*')
11th Mar 2019, 10:12 AM
HonFu
HonFu - avatar
+ 1
wow, thank you very much @HonFu
12th Mar 2019, 8:04 AM
Siyam
Siyam - avatar