+ 2
How it works?
def balik(st): if st != "": balik(st[1:]) print(st[0]) balik("rad")
3 Answers
+ 4
If an empty string is envoked with the function call of âbalik("") nothing will happen as only strings will be processed but not empty strings.
+ 4
christian, again: if an empty string is given as argument to function balik this is happening:
if st != "":
->means if st is not empty so if statement will not execute and program is terminated regularly.
code after if statement will be executed if string is not empty. result is :
d
a
r
check it out:
https://code.sololearn.com/cz2X9mb4A58T/?ref=app
+ 1
Lothar maybe my statement gone wrong, i mean how it works after an empty string called. You know this code will be executing by this way
rad
ad
d
"" -> empty string
I know the output was
d
a
r
But what happen after empty strings? Hehe