Ask coding questions

← Back to all posts
HELPPPP... my friend and i have been trying to work this out for ages!!!
xxShrutixx

What is output by the following algorithm?
notice = “Please do not walk on the grass”
start = pos (notice, “ “)
end = pos (notice, “t”)
x = substring (0, start, notice)
stringLength = len(notice)
y = substring (end + 2, stringLength – 1, notice)
print (“x = ” x) x = n
print (“y = “, y) y =
print (x + y)

Voters
xxShrutixx
Comments
hotnewtop
timmy_i_chen

Hi @xxShrutixx - you can put this in a repl and execute it to see its output: http://repl.it/languages/python3