Changes

Jump to: navigation, search

OPS435 Python Lab 1

4 bytes added, 09:09, 16 May 2017
Integer Variables
print('The sum is: ' + sum)
</source><br>What happened? Did you receive an error? This will may have been the first time you've seen this error, but it won't be the last. What we tried to do is combine a string with a number, and this won't work.<br><br>
In order to use display this number as a string we will use the "str()" function on it. The "str()" function will return a string of your number and provide it as a argument to "print()". This function will not change the value of your variable, your variable is still a interger.<br><br>
:# Issue the following:<source>
print('The sum is: ' + str(sum))
13,420
edits

Navigation menu