मराठी

Given is a Python list declaration: Listofnames = ["Aman", "Ankit", "Ashish", "Rajan", "Rajat"] Write the output of: print (Listofnames [−1:−4:−1]) - Computer Science (Python)

Advertisements
Advertisements

प्रश्न

Given is a Python list declaration:

Listofnames = ["Aman", "Ankit", "Ashish", "Rajan", "Rajat"]

Write the output of:

print (Listofnames [−1:−4:−1])
कोड लेखन
Advertisements

उत्तर

Output:

["Rajat", "Rajan", "Ashish"]

Explanation:

Listofnames [−1:−4:−1] returns elements from index −1 to −3, decrementing by −1. 

shaalaa.com
  या प्रश्नात किंवा उत्तरात काही त्रुटी आहे का?
2022-2023 (March) Set 4
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×