0

HELP : How can I [‘0.3’, ’10**2’] ==> [0.3, 10**2]

n = ['1' , '-2' ,'0.3' ,'10**2'] I want to change to this↓↓ m = [1, -2, 0.3, 10**2]

6th Feb 2019, 2:11 PM
Shumpei Sori
Shumpei Sori - avatar
3 Answers
+ 1
for i in n: i = int(i)
6th Feb 2019, 3:00 PM
Maneren
Maneren - avatar
0
It’s going to be error when i is ‘0.3’ and ‘10**2’
7th Feb 2019, 3:36 AM
Shumpei Sori
Shumpei Sori - avatar
0
Dangerous one: for i in n: i = exec(i)
7th Feb 2019, 5:29 AM
Maneren
Maneren - avatar