Sololearn: Learn to Code
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1
You have the list loop with different variable types some can be converted to int and some can't, in the code you will try to append the int of the value if you can convert them, other wise just pass to the next value So lets start by 1.0 you can convert it to int and it will give 1. Next "1.0" can not be converted to int and it will give an error so we will pass to the next value y is list which also can not be converted to int The last value is abs(5j+1) this will give the absolute of the complex number and it measuted by the formula sqrt(5**2 +1**2) which is 5.09... int of this value is 5 so you got your y =[1, 5]
17th Sep 2020, 3:13 AM
Ruba Kh
Ruba Kh - avatar