Scratch Computing Backup
Scratch Computing Backup
William Marsh
School of Electronic Engineering and Computer Science
Queen Mary University of London
Aims
x = 1
while x <= 10:
print('the number is', x)
x = x + 1
Control Statements – Close
for x in range(1, 10):
print(“Hello”)
x = 0
while x != 100:
move(1)
if mouseDown():
move(10)
else:
turn(15)
Variables – Not So Close
• Later in scratch
Variables:
• Sprite
• Global
Python uses
name for both
Steps = 0 left and right
hand side of
Steps = Steps + 1 assignment
IDEAS FROM SCRATCH TO
PYTHON
Ideas on Scratch to Python
• Redundant code
• Code that makes no difference
• Easy to include this in Scratch
Problem 1: If & Logic
• Two variables: 'name and 'age'
• Which versions are the same?
Problem 2: Counting to 5
• Which are the same?
Scratch Python
• Means the
same as:
Introduce Assignment