14th Sep 2020, 4:54 PM
sarthak srivastava
sarthak srivastava - avatar
3 Answers
+ 1
Corrected: num_1,num_2=[float(v) for v in input("enter the value of num_1 and num_2 seperated by commas").split(",")] print(num_1) print(num_2) average=(num_1+num_2)/2 print("average is "+str(average)) float() takes an integer or a string but you can't pass it a list like you were trying to
14th Sep 2020, 5:00 PM
Bagon
Bagon - avatar
+ 1
as others have mentioned the issue, so you need to loop manually and type cast the inputs or map the float() for each inputs num_1,num_2 = map(float,input("enter the value of num_1 and num_2 seperated by commas").split(",")) https://code.sololearn.com/cuVL0wRuSSR6/?ref=app
14th Sep 2020, 5:03 PM
Мг. ĐšĐœĐ°ĐżđŸŒ 
Мг. ĐšĐœĐ°ĐżđŸŒ  - avatar