Skip to content

reserve list of food items containing calories. with three different methods

Notifications You must be signed in to change notification settings

arevish/food-calories

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 

Repository files navigation

Food Calorie forthebadge

Scenario:-

You visited a restaurant 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.

Instructions to follow

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!

PRE-REQUISITES

Your laptop with 3.6.x (onwards) installed.

NOTE: Those with Linux and MacOSX would have Python installed by default, no action required.

Windows: Download the version for your laptop via https://www.python.org/downloads/

NOTE: In your preferred editor, make sure indentation is set to "4 spaces".

Run using Python3.8+

  1. Clone or download repositiory: https://github.com/arevish/food-calories.git
  2. In source folder, run python3 'reverselist.py' to start game, optionally, run with --help argument to see other runtime options.

About

reserve list of food items containing calories. with three different methods

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages