Programming Examples

Python program to increment the elements of list


Write a python program to increment the elements of a list with a number.

Solution

mylist=eval(input("Enter any List"))
print("Before increment list is ",mylist)
a=0
for b in mylist:
    mylist[a]=b+1
    a=a+1
print("After increment list is ",mylist)
Output

Enter any List[5,7,8,4]

Before increment list is  [5, 7, 8, 4]

After increment list is  [6, 8, 9, 5]

CCC Online Test 2021 CCC Practice Test Hindi Python Programming Tutorials Best Computer Training Institute in Prayagraj (Allahabad) Best Java Training Institute in Prayagraj (Allahabad) Best Python Training Institute in Prayagraj (Allahabad) O Level Online Test in Hindi Bank SSC Railway TET UPTET Question Bank career counselling in allahabad Sarkari Naukari Notification Best Website and Software Company in Allahabad Sarkari Exam Quiz