+2

need help in python

i have a list of this type ['+', '5', '4', '78'] and a variable y. i want to know how you would make the variable equal to all the number from the element [1] to the end of the list for example: list=['%', '5', '7', '34', '2'] y=57342

10/21/2019 7:55:20 PM

esd.ra

2 Answers

New Answer

+2

mylist = ['%', '5', '7', '34', '2'] y = '' for x in mylist[1:]: y += x print(y)

+4

d = ['+','5','4','78'] y =int("".join(i for i in d if i in "0123456789")) the output will be y=5478