+ 8
Can anyone write separation function ?
Can anyone write a function separating each genre by itself in Chan de Cactar Example: "hjd 652hf7 * 4,5+-4 (uy 5+4" The result is hjd # 652 # hf # 7 # * # 4,5 #+# -4 #(#uy#5#+#4 Genres → alphabet/float/integer/operation/sign of number (+ or - → positive or negative) If it's a sign → #+2# If it's a operation → #+#2#
38 Respuestas
+ 5
Abol i think op wants the answer in the format ,
"#hello#984#worl#8#-#9#a9#(#)#3,9#+#(#-9#) " for input " hello 984 world 8-9a9 () 3,9+(-9)"
+ 4
What does the e.split("#") do?
+ 4
Hi!
In the line:
dic={k:gettyp(k) for k in e.split("#")}
a dictionare is building up with k as key and gettyp(k) as value, whatever the function will return when k is an argument.
k is a variable that will iterate through the lists e.split(”#”):s element in the same way as a for loop can do.
e is a string and everywhere ”#” is in that string the string will split and the parts between the ”#” become the lists element.
/Regards Per B 🙂
+ 4
iterate through th string.
if type of char changes, seperate.
+ 4
Abol your code is outputting "#5#-4" for "5+-4" But it should output "#5#+#-4" .
+ 3
No, she means that: Entries are normal strings And you are working on separating it so that it is like this Input mam 3-6 (5) -4 * 6/3
Result #mam#3#-#6#(#5#)#-4#*#6#/#3
+ 3
Abol
I need just the 2nd input
Thank u 😊
+ 3
May God protect you👐Abol
+ 3
thank u Abol
may god protect you
+ 3
#Can anyone write separation function ?
#Can anyone write a function separating each genre by itself in Chan de Cactar Example: "hjd 652hf7 * 4,5+-4 (uy 5+4"
#The result is hjd # 652 # hf # 7 # * # 4,5 #+# -4 #(#uy#5#+#4
#Genres → alphabet/float/integer/operation/sign of number (+ or - → positive or negative)
#If it's a sign → #+2#
#If it's a operation → #+#2#
list=('hjd','652' ,'hf', '7', '*' ,'4,5' ,'+', '-4' ,'(','uy','5','+')
print (list)
+ 3
Here may be answer for ur question
+ 2
mar ia split converts a string into an array or list with the delimiter as the separator
+ 2
mar ia you can take a look at my code as well , it isn't perfect as the exact requirements aren't clear to me but it does it job.
https://code.sololearn.com/c0HTVjfCV9kW/?ref=app
+ 2
why when i change "a" string to input it didt'n worck
https://code.sololearn.com/cBsov5Z4utfg/?ref=app
+ 2
#Can anyone write separation function ?
#Can anyone write a function separating each genre by itself in Chan de Cactar Example: "hjd 652hf7 * 4,5+-4 (uy 5+4"
#The result is hjd # 652 # hf # 7 # * # 4,5 #+# -4 #(#uy#5#+#4
#Genres → alphabet/float/integer/operation/sign of number (+ or - → positive or negative)
#If it's a sign → #+2#
#If it's a operation → #+#2#
list=('hjd'+" "+'652'+" "+'hf'+" " +'7'+" "+ '*' +" "+'4,5' +" "+'+'+" " +'-4' +" "+'('+" "+'uy'+" "+'5'+" "+'+')
print (list)
+ 1
Abol how can I separate the 2 functions (who separate with # and the one who delete #) → separate the 2 inputs after "gettyp2"
+ 1
Abol if you can write what every statment do because it's not clear well
+ 1
Finally done
+ 1
Irfan Shaikh thanks
+ 1
It's my pleasure