Learners will be able to:
- Use a range of Python Operators
- Understand the difference between a string and a float
- Try out your own ideas
- applying computing-related mathematics:
- plus +
minus -
divide /
times *
Exponentiation (^)
MOD
DIV
|
|
|
In this lesson you will learn about operators. In a programming language they are used to describe five areas: arithmetic, assignment, increment/decrement, comparison, logical. These areas can be used within code to create new outcomes and respond to inputs or outputs.
Part 1: Try some operators out:
Part 1: Try some operators out:
- Look at the operator examples below, run it, on each line add a print statement' to make the operator print.
- Do these one at a time so you can see what each operator does, make a note if you need to.
Part 2: Line 17
- When you print line 17, does it print the correct answer? Why not?
- On line 17, type the code print type(a + b)
- Look at the output, research the answer
- Can you amend the code to print out the correct answer? (15)
- Now code your own operators in the console below.