Get answer of your all questions and doubts! ➤

Question
Given str1 = “Hello”, what will be the values of:
(a) str1[0]
(b) str1[1]
(c) str1[-5]
(d) str1[-4]
(e) str1[5]

[Computer Science Class – 11 Sumita Arora solutions. Chapter 6 – Data Handling.]

Answer

(a) Η

(b) e

(c) H

(d) e

(e) IndexError: string index out of range

Leave a Comment

Your email address will not be published. Required fields are marked *