0

Hi can anyone explain me this. It does not work

def spl(xx:yy) m=["xx","yy"] return m

16th Jan 2022, 12:36 PM
Mohamed Raaid
Mohamed Raaid - avatar
6 Respostas
+ 1
To use a function, you need to call or invoke it.. spl("a", "b") But also what it meaning there xx:yy in defination? May you are meaning (xx, yy) but again xx (variable) is different than "xx" (String literal) what are your try there ? edit: def spl(xx,yy) m=[xx,yy] return m lst = spl("a", "b") print(lst)
16th Jan 2022, 1:02 PM
Jayakrishna 🇮🇳
0
Ok i will try this
17th Jan 2022, 4:48 AM
Mohamed Raaid
Mohamed Raaid - avatar
0
Hi sorry i couldn't check That it should divide a variable If input is = "hiworld" This function should output ["hi","world"]
17th Jan 2022, 11:26 AM
Mohamed Raaid
Mohamed Raaid - avatar
0
What is the key to divide there? For example, if input= "abcdefg", what is your expected output? Mohamed Raaid
17th Jan 2022, 5:11 PM
Jayakrishna 🇮🇳
0
May you are trying splitting input by a space, then read about split() function again... See there examples... Hope it helps..
17th Jan 2022, 5:15 PM
Jayakrishna 🇮🇳
0
Hi split function only splits sentence but it does not separate words Split function work as below Eg:- x= "hi world" x.split() Outputs-["hi","world"] But i need to get as below x="hi" And that defineed function should output as-["h","i"]
18th Jan 2022, 11:01 AM
Mohamed Raaid
Mohamed Raaid - avatar