Course Content

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

The task you have to perform is “Foods and Calories.” This task consists of a total of 15 points to evaluate your performance.

Problem Statement:-

You visited a restaurant called CodeWithHarry, and the food items in that restaurant are sorted, based on their amount of calories. You have to reserve this list of food items containing calories.

You have to use the following three methods to reserve a list:

  • Inbuild method of python
  • List name [::-1] slicing trick
  • Swap the first element with the last one and second element with second last one and so on like,

[6 7 8 34 5] -> [5 34 8 7 6]

Input:

Take a list as an input from the user

[5, 4, 1]

Output:

[1, 4, 5]

[1, 4, 5]

[1, 4, 5]

All three methods give the same results!

You are advised to participate in solving this problem. The solution is discussed in tutorial#108

Code as described/written in the video



Be the first person to comment!

Comments(0)

Resources

No downloadable resources for this video. If you think you need anything, please post it in the QnA!

Course Announcements

Any Course related announcements will be posted here