11 Antworten
+ 3
>>> is just the interpreter prompt for Python. We don't need it if we run a code in the Code Playground.
+ 3
Yep!
And even when using an interpreter, you wouldn't need to manually type the >>>. It'd be displayed there automatically.
+ 3
Haha! You're welcome! :)
+ 3
Those are two different things. "2" and "3" are strings. "2" + "3" concatenates (puts them side-by-side) those two strings to get the new string "23". But if we just did 2 + 3, that would be adding the numbers 2 and 3. The result is 5. Does that make sense?
You'll soon learn more about them in the tutorial.
+ 3
Yes, doing 2 + 3 would be much better than int("2") + int("3") in that case. But as you'll soon see, sometimes we don't have a choice. It was just an illustration.
0
print ( 1 + 2 )
Is this the way i code it then?
0
You are a king! Thanks!
0
Last question i promise lol
print "2" + "3"
23
Why would i want to use the double quotation
Wouldn't
print (2 + 3)
Be easier?
0
Yes the tutorial said if i want the concatenates to add "2" + "3" to get 5 i need to...
int("2") + int("3")
To get 5 or something like that
Why not just take it to the original math instead of going around it like that?
0
Or is it to convert strings into intergers sorry if it is converting lol
0
I just got confused but i do see now that it is to convert strings to intergers...
I feel stupid now