0

Python challenge

What is the output of the following code ? example = "snow world" Print("%s" % example [4:7]) a = wo, b = sn, c = world, d = di Can someone please tell me the answer and explain how you got ... I understand the slicing methods and the things that tricks me it's the mod operator, I never used it in strings before, please help

6th Jun 2020, 2:42 PM
PLEASURE MAKOFANE
PLEASURE MAKOFANE - avatar
2 Antworten
+ 5
If you take these few lines of code and put it in playground and run them you will see the result. What you called the 'mod-operator' is a placeholder for outputting data. You dont need this in this sample, and can just be replace by: print(example[4:7])
6th Jun 2020, 6:24 PM
Lothar
Lothar - avatar
+ 2
Here you are using Python2 syntax... if python2 %variable is used to replace placeholder in string.... Here output will be " wo".... Notice there is space in begin...
6th Jun 2020, 3:38 PM
DeWill
DeWill - avatar