Changes

Jump to: navigation, search

OPS435 Python Lab 1

38 bytes added, 20:33, 16 January 2018
Printing Text
print()
</source>And run it from the command-line in one of two ways:<source>./test.py</source> or <source>python3 ./test.py</source>Note that the file will need execute permissions for the first way of running it, but not for the second. Why is that? You will also notice that nothing is printed even though we called the "print()" function. This is because we didn't pass any arguments to it, lets try again.<br><br>
:# Issue the following functionModify your call to print() to inlcude an argument ('hello world'):<br><source>
print('hello world')
</source>This time we should now see that the python function "print()" has outputted to the screen the words 'hello world'. In python a word or a bunch of characters like 'hello world' is called a 'string'. In the above example, a '''string''' was passed as a '''argument''' to the print '''function'''. These words are important for understanding and talking about different aspects of code.<br><br>

Navigation menu