Changes

Jump to: navigation, search

OPS435 Python Lab 3

135 bytes added, 08:42, 31 May 2017
PART 1 - Using Functions
print(number + 5)
print(return_number_value() + 10)
</source> What do you notice?<br><br> You should notice a warning message. This occurs because :#Now, issue the following which use the returning value is a '''number''' and NOT a '''string'''! Combining numbers and strings in a statement (such as '''print()''') can cause errors. The error message should appear similar statement to the one displayed belowdisplay both strings and numbers: <source>
number = return_number_value()
print('my number is ' + number)
</source> What do you notice? You should notice a warning message. This occurs because the returning value is a '''number''' and NOT a '''string'''! Combining numbers and strings in a statement (such as '''print()''') can cause errors. The error message should appear similar to the one displayed below: <source>
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
13,420
edits

Navigation menu