Suppose it is mandatory to have the following types of food in the lunch menu of the passengers. Food items are Welcome Drink, Veg Starter, Non-Veg Starter, Veg Main Course, Non-Veg Main Course, Dessert How can we store it such that no one can modify the elements and write in detail.
Answers
Answered by
1
Answer:
twtws1psg23d4jd4u23t afarahrarajbhati
Answered by
4
For this case, we can use the data type Tuple.
Explanation:
- Similar to the list, a tuple can also deposit a sequence of elements but the value of the elements can’t be modified.
- From this, it is meant that tuples are immutable.
- Elements of the sequence can be heterogeneous or homogeneous but they are read-only.
- For this case, the tuple will be written as:
- If someone tries to modify the tuple with a random write such as Lunch menu[0]=“”, it will result in an error.
Similar questions