+ 3
Type of variable
Why does print automatically not get strongly type d when adding integers in Python 3?
8 Antworten
- 1
I don't understand your question.
+ 3
did you want to know why "string"+number is not allowed in print statements?
because in python, you can only concatenate string to string, no implicit casting is done...
so you either require:
print("string"+str(number))
or:
print("string",number,sep="")
... or others string formatting ways (old and new string formats)
+ 2
@visph I don't think it is a good feature 💻
+ 2
Théophile that would be perfect if best answer mark was not misused ^^
but it seems that OP don't like the "feature" explained in my answer and prefer finally set your answer as best :(
+ 1
that's not the question.
it is as it is designed...
mail guido about it if you want, but discuss here would not change it ^^
+ 1
and marking best answer the one wich tell you he doesn't understand your question is not fair...
mark none if you (really) want, but don't mark not useful answers ^^
0
I actually still don't understand his question :
"why does print doesn't automatically get strongly typed when adding integers"
It doesn't mean anything 🤷♂️
And I can't find the link with addition between strings and integers 🙄
But anyway, if the visph's answer answers his question, that's perfect.