Computer Science
What is the result of the following expression?
s ='987654321'
print (s[-1], s[-3])
print (s[-3:], s[:-3])
print (s[-100:-3], s[-100:3])
Python
Python String Manipulation
18 Likes
Answer
1 3
321 987654
987654 987
Answered By
10 Likes
Related Questions
What is the result of the following expression?
print ('One', ' Two ' * 2) print ('One ' + 'Two' * 2) print (len('10123456789'))
What is the result of the following expression?
s = '0123456789' print(s[3], ", ", s[0 : 3], " - ", s[2 : 5]) print(s[:3], " - ", s[3:], ", ", s[3:100]) print(s[20:], s[2:1], s[1:1])
What will be the output produced by following code fragments?
y = str(123) x = "hello" * 3 print (x, y) x = "hello" + "world" y = len(x) print (y, x)
What will be the output produced by following code fragments?
x = "hello" + \ "to Python" + \ "world" for char in x : y = char print (y, ' : ', end = ' ')