@junaidtomlin_francis/

Programming Terms KS4

Python

No description

fork
loading
Files
  • main.py
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# What type of programming is this - Sequence or Selection?
name = "James Hetfield"
age = 53

print("Hello",name)
print("You are",age,"years old.")

# What type of programming is this - sequence
name = "Kirk Hammett"
age = 55

if name == "Kirk Hammett":
  print("Hey Kirk")
else:
  print("You are not Kirk")

if age == 55:
  print("You are 55")
else:
  print("You are not 55")

# What type of programming is this -  Selection
print("Hello")
print(2 + 2)

# What type of programming is this - Sequence 
isHungry = True

if isHungry == True:
  print("You are hungry")
else:
  print("You are full up.")

# What type of programming is this -  Selection?
age = 0
age += 1
age = age * 2
print(age)
age += 1
age = age * 2
print(age)

# What type of programming is this - Sequence 
applesEaten = 7

if applesEaten >= 5:
  print("Thats a lot of apples")
elif applesEaten > 10:
  print("Slow down, thats a lot of fibre.")
else:
  print("You should eat more apples.")

# What type of programming is this -  Selection?
member = "Adult"
day = "Friday"
cost = 0

if member == "Child":
  if day == "Saturday":
    cost = 2.0
  else:
    cost = 1.5
else:
  if day == "Saturday":
    cost = 4.0
  else:
    cost = 2.0

print("The cost is £",cost)