Aug-02-2019, 07:23 PM
(This post was last modified: Aug-02-2019, 07:31 PM by Johnny1998.)
NOTE: I am executing the Python langauge in Atom, a Text Editor for Coding.
I have a Homework assignment in which I'm supposed to get the following code to print out the expected output; 3.
I get the following error:
Thanks,
Johnny
@Yoriz
@ichabod801
Thanks! I will endeavor to not make this mistake again, Sorry!
I have a Homework assignment in which I'm supposed to get the following code to print out the expected output; 3.
a = "1" b = 2 print(a + b)I presume you have to convert the string; a, or "1" to a integer. Yet, when I change the above code to:
a = "1" b = 2 int("1") print(a + b)(Which I assume is the correct way to do things?)
I get the following error:
Output:Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: can only concatenate str (not "int") to str
Any help would be greatly appreciated! Thanks,
Johnny
@Yoriz
@ichabod801
Thanks! I will endeavor to not make this mistake again, Sorry!