Computer Science, asked by ThisUsernamesTooLong, 3 months ago

Computer Science, Python.

Write a program to increment the elements of the list with a number?

Answers

Answered by Equestriadash
84

n = int(input("Enter the number of elements to be entered in the list: "))

print()

l = list()

for i in range(n):

  x = int(input("Enter the element: "))

  l.append(x)

  print()

print("Original list: ", l)

print()

icn = int(input("Enter the number by which each element needs to increment: "))

print()

for i in range(len(l)):

  l[i] = l[i] + icn

print("New list: ", l)


Equestriadash: Thanks for the Brainliest! ^_^"
pandaXop: Perfect Explanation (・o・)
Equestriadash: Thank you! ^^"
Answered by ItzIshan
38

Question :-

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

AnsweR :-

The python program for increment the elements of the list with a number -

n = int(input ("Enter the number of elements of the list - "))

print()

l = list ()

for i in range(n)

x = int(input("Enter the elements = "))

l.append(x)

print()

print ("original list = " l)

print()

increament = int(input ("Enter the number of increment in each element ="))

print()

for i in range( len(l)) :

l[I] = l[i] + increament

print("New list = " l)

_____________________________

Hope it will help you :)

Similar questions