Lesson 5 Programming Tecniques - Students 9b It 2
Lesson 5 Programming Tecniques - Students 9b It 2
print("hello world")
.7
5
5
Here are some examples of integers:
.7
5
5
Here are some examples of real numbers:
Temperature =
Price = 1.84 Height = 1.85
18.5
Boolean
The Boolean data type supports only two different values:
True and False.
0 = False 1 = True
Overdue = Authorised =
False True
Character
print (2+2+2+2+2)
print (8*6)
print (10-5+6)
print ( 2 + 2)
What happens?
• Expressions
You have been using expressions
2 values and an operator
Even the 2+2+2+2 follows this
rule
2+2 addition
6>5 True
!= Not equal to
Boolean operators
There are 3 Boolean operators: AND, OR, NOT.
print (a + b)
print (5 + 6 / 7 +)
Variables
A variable is just a box with a number in it.
To store the value 15 in the variable and display it Now try these
spam = spam + 12
spam = 15 print (spam)
print (spam) spam = spam + spam
print (spam)
Try it. spam = spam * spam
print (spam)
Variables
This time we have 2 variables eggs and fizz
You can assign them by
eggs = 15
fizz = 10