-3
a = [5,7,11,2,6,8]
print('Toplanılanlar: pleyer , telefon, hiroskuter, it, kompüter, 3d-printer')
print(a)
print('Bütün toplanılan neçə manat artdı?')
manat = input()
for i in range(6): 
  #i need smthng to add here  
print('Toplanılanların yenilənmiş siyahısı:')
print(a)
Haris
  • 12,120
  • 6
  • 43
  • 70
  • 3
    what is your question exactlt? – deadshot May 02 '20 at 11:03
  • 4
    I find it unlikely that you are using both python 2 and python 3. Why tag it with both? – John Coleman May 02 '20 at 11:05
  • manat = input(); print(list(map(lambda a: a+manat, a))); print('Toplanılanların yenilənmiş siyahısı:'); Add this to your code – knownUnknown May 02 '20 at 11:18
  • a = [5,7,11,2,6,8] print('Toplanılanlar: pleyer , telefon, hiroskuter, it, kompüter, 3d-printer') print(a) print('Bütün toplanılan neçə manat artdı?') manat = input(); print(list(map(lambda a: a+manat, a))); print('Toplanılanların yenilənmiş siyahısı:'); manat = int(input()) new_lst = [item + manat for item in a] – Droidshizonoid May 02 '20 at 11:23
  • [0:0] unsupported operand type(s) for Add: 'int' and 'str' – Droidshizonoid May 02 '20 at 11:23
  • exact question is that i need to add a number that i want to all integers in list – Droidshizonoid May 02 '20 at 11:24
  • Please [edit](https://stackoverflow.com/posts/61558294/edit) the question with an explanation of the problem you're experiencing and the expected behaviour. – Run_Script May 02 '20 at 13:56

4 Answers4

0

Probably you're looking for

manat = int(input())
for i in len(a):
    a[i] += manat

Or form a new list:

manat = int(input())
new_lst = [item + manat for item in a]
Jan
  • 42,290
  • 8
  • 54
  • 79
0

If what you want is to add an int to each element of your list, you can probably find an answer here. Anyways, try something like:

for i in range(len(a)):
    a[i] += manat
Sersovi
  • 3
  • 3
0

if I have understood your question, your answer is something like this:

a = [5, 7, 11, 2, 6, 8]
for i in range(len(a)):
    a[i] += 1

so the result will be:

a = [6, 8, 12, 3, 7, 9]
Arsham Arya
  • 1,461
  • 3
  • 17
  • 25
0

With your prompts written in Azerbaijani, it's not obvious what you are trying to do (at least not for us people who don't speak that language).

In all cases, it is not necessary to loop on a range.

If you are prompting the user for a single number that will increase all counts by the same amount:

a = [ c + int(manat) for c in a ]

If you are prompting the user for a list of 6 increments applying to each count respectively:

a = [ c + int(i) for c,i in zip(a,manat.split()) ]
Alain T.
  • 40,517
  • 4
  • 31
  • 51