0
Why
print(2+3) print(int("2") + int("3")) They both produce same results. Why code long when you can get same output?
7 ответов
+ 1
Int and str are functions which convert characters into strings into non strings and vice versa. Sometimes when coding you need to use same data types in the same the program but with different (like the data type x=1. When you want to use it as string you write str(x) but when you want this data type to do calculation you use int(x) and so on.
+ 2
This code above is for demo and learning.
Generally one often has to deal with textlike numbers.
Knowledge about converting is necessary.
+ 1
"122"
0
yes. Whats the advantage of coding longer when coding bring same result?
0
Can you give example of textlike numbers please?
0
Thanks
0
Okay. Thanks for explaining