Python Practice 3 | Python Tutorials For Absolute Beginners In Hindi #107

Foods and Calories

You visit a restaurant called CodeWithHarry and food items in this restaurant are sorted based on their amount of calories. You have to reverse this list of food items containing their calories.

You have to use following three methods to reverse a list:

• Inbuilt method of python
• Listname[::-1] slicing trick
• Swapping first element with last one and second element with second last one and so on….
Input:
Take a list as an input from the user.
[5,4,1]

Output:
[1,4,5]
[1,4,5]
[1,4,5]
All the three methods give same results!
►Full Python tutorials for absolute beginners (Hindi) playlist - https://www.youtube.com/playlist?list=PLu0W_9lII9agICnT8t4iYVSZ3eykIAOME
►Click here to subscribe - https://www.youtube.com/channel/UCeVMnSShP_Iviwkknt83cww

Code as described/written in the video





Be the first person to comment!

Comments(0)