Computer Science, asked by mohankeshri01, 1 month ago

# @ Find output of following program
#slices of string
strl="i-love-my-india"
print (stri)
print (str1[3:7])
print (stri[:5])
print (str1[4:])​

Answers

Answered by shreyanshsagar10
0

Answer:

1. i-love-my-india

2.love-

3.i-lov

4.ve-my-india

Answered by IIAstuteIshII
4

ɧɛƖƖơ ɱąɬɛ

Qᴜᴇsᴛɪᴏɴ:

Fɪɴᴅ ᴛʜᴇ ᴏᴜᴛᴘᴜᴛ ᴏF ᴛʜᴇ Fᴏʟʟᴏᴡɪɴɢ :

ᴀɴsᴡᴇʀ:

ɢɪᴠᴇɴ:

str1= "i-love-my-india"

____________________

1)

ɪɴᴘᴜᴛ:

print(str1)

ᴏᴜᴛᴘᴜᴛ:

i-love-my-india

ᴇxᴘʟᴀɴᴀᴛɪᴏɴ Fᴏʀ ᴛʜᴇ ᴏᴜᴛᴘᴜᴛ:

ɪᴛ ᴘʀɪɴᴛs ᴛʜᴇ ᴡʜᴏLᴇ sᴛʀɪɴɢ

____________________

2)

ɪɴᴘᴜᴛ:

print(str1[3:7])

ᴏᴜᴛᴘᴜᴛ:

ove-

ᴇxᴘʟᴀɴᴀᴛɪᴏɴ Fᴏʀ ᴛʜᴇ ᴏᴜᴛᴘᴜᴛ:

ɪᴛ ᴘʀɪɴᴛs ᴛʜᴇ sᴛʀɪɴɢ  ᴡʜᴏsᴇ ɪɴᴅᴇx sᴛᴀʀᴛs Fʀᴏᴍ 3 ᴀɴᴅ ᴘʀɪɴᴛs ᴛɪʟʟ ɪɴᴅᴇx 6 ᴀs ᴛʜᴇ ᴇɴᴅ ᴠᴀʟᴜᴇ ɪs ᴛᴀᴋᴇɴ ᴀs ᴇɴᴅ-1

____________________

3)

ɪɴᴘᴜᴛ:

print(str1[:5])

ᴏᴜᴛᴘᴜᴛ:

i-lov

ᴇxᴘʟᴀɴᴀᴛɪᴏɴ Fᴏʀ ᴛʜᴇ ᴏᴜᴛᴘᴜᴛ:

ɪᴛ ᴘʀɪɴᴛs ᴛʜᴇ sᴛʀɪɴɢ  ᴡʜᴏsᴇ ɪɴᴅᴇx sᴛᴀʀᴛs Fʀᴏᴍ 0 ᴀɴᴅ ᴘʀɪɴᴛs ᴛɪʟʟ ɪɴᴅᴇx 4 ᴀs ᴛʜᴇ ᴇɴᴅ ᴠᴀʟᴜᴇ ɪs ᴛᴀᴋᴇɴ ᴀs ᴇɴᴅ-1

____________________

4)

ɪɴᴘᴜᴛ:

print(str1[4:])

ᴏᴜᴛᴘᴜᴛ:

ove-my-india

ᴇxᴘʟᴀɴᴀᴛɪᴏɴ Fᴏʀ ᴛʜᴇ ᴏᴜᴛᴘᴜᴛ:

ɪᴛ ᴘʀɪɴᴛs ᴛʜᴇ sᴛʀɪɴɢ  ᴡʜᴏsᴇ ɪɴᴅᴇx sᴛᴀʀᴛs Fʀᴏᴍ 4 ᴀɴᴅ ᴘʀɪɴᴛs ᴛɪʟʟ  ᴛʜᴇ ᴇɴᴅ ᴀs ᴛʜᴇ ᴇɴᴅ ᴠᴀʟᴜᴇ ɪs ɴᴏᴛ ᴍᴇɴᴛɪᴏɴᴇᴅ.

____________________

ɧơ℘ɛ ıɬ ɧɛƖ℘ʂ ყơų  ☺

Similar questions