Topic Two: Programming
​
All software has been created a programmer, or teams of programmers. They write code in a programming lanage such as Python, Visual Basic, Java, C++ and create interactive programs and applications.
​
When you approach a programming problems the first thing you need to do is know what the INPUT of the program will be and then what the OUTPUT required.
​
EXAMPLE:
​
We need a program that calculates if I have passed my exam.
​
The INPUT would have to be:
1. What the exam total marks are - for example 50 marks
2. What number of marks did the user achieve - for example 39/50 marks
​
The OUTPUT would be "PASS" or "FAIL"
​
So now we need to do the calculations to convert the two numbers to that output.
​
Percentage = (MyMarks/TotalMarks) * 100
​
IF Percentage >=50% THEN
Display "PASS"
ELSE
Display "FAIL"
END IF
​
So now let's write the full algorithm! Don't forget Start and End and don't forget to indent!
​
START
Read in TotalMarks
Read in MyMarks
Percentage = (MyMarks/TotalMarks) * 100
​
IF Percentage >=50% THEN
Display "PASS"
ELSE
Display "FAIL"
END IF
END
​
Below is the Python programming that will do the job. You can access the Python IDE here.
​
TotalMarks = input(int("What was the Exam Total Marks?))
​
MyMarks = input(int("How many marks do you get?))
​
Percentage = (MyMarks/TotalMarks)*100
if Percentage >= "50":
print("PASS")
else:
print("FAIL")
​
​
Students should read and complete the first five modules of GROK LEARNING for the Microbit. The Microbit is a small device that you can program in python code.
​
The image above is a Micro:Bit. These are mini computers that you can program.
​
Once you have completed the Modules in the Micro:Bit Crash Course above try and make a UNIQUE virtual pet. The Virtual Pet instructions are available fromt he link below, but can you create a pet that interacts with other pets via the radio transmitter, responds to being moved or get it to sing your favourite song?