38. Problem to replace the last and the first number of the list

In this program, we will take a user input as a list and replace the last and the first number of the list with the word with the help of the below-given steps.

Replace the last and the first number in a list:

Steps to solve the program
  1. Take a list as input.
  2. Replace the 1st element i.e. element with index value 0 with “SQA”.
  3. Replace the last element i.e. element with index value -1 in the reverse order with “TOOLS”.
  4. Print the list to see the output i.e. replace the last and the first number with a word.

Output :

Related Articles

Get all the unique numbers in the list

Check the given element exists in the list

Leave a Comment