Computer Science, asked by TakshitParihar, 5 months ago

Write output for the slicing:

A = „ amazing „

1) print (a{ : 3}

2) print (a{ 2:5}

3) print (a{7})​

Answers

Answered by rishita29gupta
1

Answer:

ama

azi

Explanation:

Indexing :

a     m    a    z    i    n    g

0     1      2    3   4   5    6

A = "amazing"

print(A[:3])

Ans: ama      (as this will take values from 0 to 2 as python takes one value                        

                        less)

print(A[2:5])

Ans: azi         (this will take values from index 2 to 4 ,same reason)

print(A[7])    there is some error in this part this should be like A[:7]

and it will print from index 0 to 6

Similar questions