Q. What will be the output produced by following code fragments?
(a)
y = str(123)
x = "hello" * 3
print (x , y)
x = "hello" + "world"
y = len(x)
print (y, x)
(b)
x = "hello" +
"to Python" +
"world"
for chr in x :
y = chr
print (y, ":", end = ' ')
(c)
x = "hello world"
print (x[:2], x[:-2], x[-2:])
print (x[6], x[2:4])
print (x[2:-3], x[-4:-2])
Answer =
(a)
Output: -
hellohellohello 123
10 helloworld
>>>
(b)
Output: - It give error that value of x is not defined well.
(c)
Output: -
he hello wor ld
w ll
llo wo or
>>>
nn
ReplyDeleteWhat ????
DeleteHlo do you have a platform where you explain all this
ReplyDeletePlease ask here or telegram.
Deletethankyou so much for ur uploads <3 im passing exams because of you
ReplyDeleteWelcome : )
Deleteu are going grt like u<3
ReplyDeletePost a Comment
You can help us by Clicking on ads. ^_^
Please do not send spam comment : )