+ 1
why the output put is [1,2,,3,"40,5"]
4 Respostas
+ 6
Initially,
num=[1,2,3]
num.append("4")
# by now num = [1,2,3,"4"]
num[3]+=str(.5)
# .5 is actually 0.5 (a float)
# str(0.5) => "0.5"
# num[3] is "4", concatenate that
# with "0.5" and it becomes "40.5"
# by now num = [1,2,3,"40.5"]
That's what happened, and how : )
+ 5
Yusof , it's normal when you concatenate two strings =>"4" +"0.5" = "40.5" 🐱
+ 2
TheWh¡teCat 🇧🇬 thank you
+ 2
Ipang Thanks