Jump to: navigation, search

OPS435 Python Lab 1

52 bytes added, 08:17, 16 May 2017
no edit summary
During this investigation we will start writing our very first python scripts. These will be very basic and help us practice syntax and foundational foundation skills, such as: outputing outputting text to the screen, storing data inside variables, and using math operators.
=== PART 1 - PRINTING Common Introductory Python Functions === ====Printing Text====
Lets start IPython interpreter and start writing some python code.
:::Our first python code we will write is the print function. A function is code that has been defined in another location. Functions can take arguments, use these arguments in some way, and then usually return a result. The first function we will use is the "print()" functions, it's sole purpose is to output information to the screen.
:::You will notice that nothing happened when we ran this "print()" function. This is because we didn't pass any arguments to it, lets try again.
:::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'. So what we did above is, passed a '''string''' as a '''argument''' to the print '''function'''. These words are important for understanding and talking about different aspects of code.
=== PART 2 - HELLO WORLD =Creating the introductory "Hello World" Script====
Next, we will make our first script with the above function. Open a new text file called "".
=== Part 2 - Lab Check lab1a ===
This course is designed with a unit testing suite, which can be used to look at the scripts you write and give real-time feedback. This feedback is not perfect, however it may offer some hints if you get stuck with a error. It can also be used to make sure you are on the write track, and show progress.

Navigation menu