The Student Room Group

Computer science

What is output by the following algorithm?
notice = "Please do not walk on the grass"
start=pos (r notice," ")
end = pos (notice, "t")
x = substring (0,start, notice)
stringLength=len(notice)
y = substring (end+2, stringLength - 1 , notice)
print ("x = "x)
print (“y= , y)
print (x + y)
Reply 1
It will output
x = Please
y = walk on the grass
Please walk on the grass
Original post by Techtech123
It will output

If this is the OP's homework then they're not going to learn anything by simply being given the answer.
(edited 4 years ago)
Reply 3
Original post by winterscoming
If this is the OP's homework then they're not going to learn anything by simply being given the answer.

I actually Direct Messaged the reasoning to him.

Quick Reply

Latest

Trending

Trending