0
Why those codes?
Why this code work x="3" y="3" z=int(x)+int(y) print(z) And this doesn't work x="3" y="3" z=(x)+(y) print(z) And why this work print(num:=int(input()) And this doesn't print(num:=(input()) and what is the (int) and what it means and when must I put it 🤔
1 Odpowiedź
+ 4
input() always returns string and "3" is also a string, so if you want to sum numbers, you need to convert them to a numeric data type. For instance to integer using int()