• Edexcel GCSE CS
    • Past papers >
      • 2020 Current spec (coming soon) >
        • Programming Language Subset (PLS)
      • Old 2016 SPEC >
        • Paper 1 (specimen1)
        • Paper 1 (specimen2)
        • Paper 1 (2018)
        • Paper 1 (2019)
        • Paper 2 (specimen1)
        • Paper 2 (2018)
        • Paper 2 (2019)
      • OLD 2013 SPEC >
        • Sample assessment 1 (old spec)
        • Sample assessment 2 (old spec)
        • June 2017 (old spec)
        • June 2016 (old spec)
        • June 2015 (old spec)
    • Paper 1 (by topic) >
      • Algorithms
      • Application software
      • Ascii
      • Binary
      • Cache
      • Client Server
      • Cloud
      • Compression
      • Computational thinking
      • CPU
      • Cyber security
      • Database
      • Fetch decode execute cycle
      • Embedded system
      • Encryption
      • File size
      • Flow chart
      • Hexadecimal
      • High Level language
      • ISP/Internet
      • Logic
      • Magnetic HDD
      • Networking
      • Open source
      • Operating system
      • Peer to peer
      • Images (Data representation)
      • Protocols
      • RAM
      • ROM
      • Run length encoding
      • Simulation software
      • Solid state HDD
      • Sound
      • Stored program concept
      • Utility software
    • Curriculum >
      • Binary
      • Hex
      • Data Representation
      • Compression
      • Encryption
      • What is a computer
      • How does a computer work
      • Hardware
      • Operating system
      • The CPU
      • Input devices
      • Data storage
      • Networks
      • Microcontrollers
      • Computational models
      • Emerging trends
      • Virtual machine
      • Models and simulators
      • Algorithms
    • Python >
      • Help with Python >
        • Finding python
        • Python coding >
          • Comments
          • Data types
          • Variables
          • If Else
          • If Elif Else
          • Functions
          • For loop
          • While loop
          • Data structures >
            • Looping thru 2D array
          • String slicing/indexing
          • user defined function
          • Local/global variable
          • Validation and try
          • methods
          • File I/O
          • Pseudocode
          • Modules >
            • Turtle
          • Classes
          • NEA/Projects
        • Python questions
  • KS3/Other
    • KS3 >
      • E-Safety >
        • E-Safety intro
        • Screen time
        • E-Safety questions
      • Hardware >
        • All Hardware
        • Magnetic hard disk drive
        • Optical disk drive
        • Solid state drive
      • Software
      • Binary/Hex/Algorithms >
        • Binary
        • Hexadecimal - 1 digit
        • Hexadecimal - 2 digits
        • Algorithms
        • ASCII
        • Tests
      • Networks
      • Protocols/Cyber attacks
      • Scratch
      • Logic >
        • CPU
        • AND gate
        • OR gate
        • NOT gate
        • Logical statements
      • Python >
        • Getting started
        • Functions
        • Variables
        • VariablesToo
        • inputs
        • Selection
        • Flowcharts
        • Data types
        • Pseudocode1
        • Pseudocode2
        • Subprogram1
        • Subprogram2
        • Coding challenges
      • HTML
    • BTEC CS
    • OCR GCSE CS >
      • Past paper JUNE 2015
      • Past paper June 2014
      • Past paper MAY 2012
      • Past paper JAN 2011
      • Past paper JUN 2011
    • AQA AS-Level CS >
      • AS Curriculum >
        • Multiple choice questions
    • Business studies >
      • Keywords
      • BS Revision - Multiple choice
      • Paper 1 (9-1)
      • Paper 2 (9-1)
  • Contact/More
    • Code editor
    • Contact us
    • upload
    • Microbit ideas
    • More
  • Self test
    • 01 Random topics
    • 02 Programming
    • 03 Data
    • 04 Computers
    • 05 Communication and the internet
    • 06 The bigger picture
    • 07 Paper 2

Python coding

PYTHON DICTIONARY


Comments

Data types

Variables

If Else

If Elif Else

Functions

For loop

While loop

Data structures

String slicing

User defined function

Local/Global variable

Validation and Try

Methods

​File I/O

Pseudocode

Modules​

Pseudocode

Pseudocode means ‘mock’ or ‘pretend’ code and that it is way of describing/writing a program without using a specific programming language.

Pseudocode uses control structures and keywords similar to those found in programming languages.
Example of psedocode is:

SET name TO ‘dude’

How would this look in Python?
You need to be able to understand and use pseudocode but not write programs using it.

Python code example:

for a in range(0, 10):
    print (a)

The pseudocode for the above code is

FOR a FROM 0 TO 10
  SEND 0 to 10 TO DISPLAY
END FOR

Pseudocode:

hunger is set to N
WHILE hunger does not = Y DO
  RECEIVE hunger FROM (STRING) KEYBOARD and SEND ‘Are you hungry yet’ TO DISPLAY
SEND ‘So eat!’ TO DISPLAY
END WHILE

Python code:

hunger = "N"
while hunger != "Y":
    hunger = input("Are you hungry yet??")
print("so eat!")


Pseudocode challenge 

​What does this pseudocode do?

RECEIVE myName FROM (STRING) KEYBOARD
RECEIVE myAge FROM (INTEGER) KEYBOARD
SET AgeInTen TOmyAge + 10
SEND myName “will be” AgeInTen “in 10 years’ time” TO DISPLAY

Write the Python code for this program.

Past exam paper

Below is a question from a past edexcel exam paper. The question is some pseudocode with a 5 mark question at the end. Try coding the question in Python to help you understand both psedocode and the Python code needed to code it.
Picture
Picture
Answer - click here
Picture
Home
Contact
Upload
Log in
  • Edexcel GCSE CS
    • Past papers >
      • 2020 Current spec (coming soon) >
        • Programming Language Subset (PLS)
      • Old 2016 SPEC >
        • Paper 1 (specimen1)
        • Paper 1 (specimen2)
        • Paper 1 (2018)
        • Paper 1 (2019)
        • Paper 2 (specimen1)
        • Paper 2 (2018)
        • Paper 2 (2019)
      • OLD 2013 SPEC >
        • Sample assessment 1 (old spec)
        • Sample assessment 2 (old spec)
        • June 2017 (old spec)
        • June 2016 (old spec)
        • June 2015 (old spec)
    • Paper 1 (by topic) >
      • Algorithms
      • Application software
      • Ascii
      • Binary
      • Cache
      • Client Server
      • Cloud
      • Compression
      • Computational thinking
      • CPU
      • Cyber security
      • Database
      • Fetch decode execute cycle
      • Embedded system
      • Encryption
      • File size
      • Flow chart
      • Hexadecimal
      • High Level language
      • ISP/Internet
      • Logic
      • Magnetic HDD
      • Networking
      • Open source
      • Operating system
      • Peer to peer
      • Images (Data representation)
      • Protocols
      • RAM
      • ROM
      • Run length encoding
      • Simulation software
      • Solid state HDD
      • Sound
      • Stored program concept
      • Utility software
    • Curriculum >
      • Binary
      • Hex
      • Data Representation
      • Compression
      • Encryption
      • What is a computer
      • How does a computer work
      • Hardware
      • Operating system
      • The CPU
      • Input devices
      • Data storage
      • Networks
      • Microcontrollers
      • Computational models
      • Emerging trends
      • Virtual machine
      • Models and simulators
      • Algorithms
    • Python >
      • Help with Python >
        • Finding python
        • Python coding >
          • Comments
          • Data types
          • Variables
          • If Else
          • If Elif Else
          • Functions
          • For loop
          • While loop
          • Data structures >
            • Looping thru 2D array
          • String slicing/indexing
          • user defined function
          • Local/global variable
          • Validation and try
          • methods
          • File I/O
          • Pseudocode
          • Modules >
            • Turtle
          • Classes
          • NEA/Projects
        • Python questions
  • KS3/Other
    • KS3 >
      • E-Safety >
        • E-Safety intro
        • Screen time
        • E-Safety questions
      • Hardware >
        • All Hardware
        • Magnetic hard disk drive
        • Optical disk drive
        • Solid state drive
      • Software
      • Binary/Hex/Algorithms >
        • Binary
        • Hexadecimal - 1 digit
        • Hexadecimal - 2 digits
        • Algorithms
        • ASCII
        • Tests
      • Networks
      • Protocols/Cyber attacks
      • Scratch
      • Logic >
        • CPU
        • AND gate
        • OR gate
        • NOT gate
        • Logical statements
      • Python >
        • Getting started
        • Functions
        • Variables
        • VariablesToo
        • inputs
        • Selection
        • Flowcharts
        • Data types
        • Pseudocode1
        • Pseudocode2
        • Subprogram1
        • Subprogram2
        • Coding challenges
      • HTML
    • BTEC CS
    • OCR GCSE CS >
      • Past paper JUNE 2015
      • Past paper June 2014
      • Past paper MAY 2012
      • Past paper JAN 2011
      • Past paper JUN 2011
    • AQA AS-Level CS >
      • AS Curriculum >
        • Multiple choice questions
    • Business studies >
      • Keywords
      • BS Revision - Multiple choice
      • Paper 1 (9-1)
      • Paper 2 (9-1)
  • Contact/More
    • Code editor
    • Contact us
    • upload
    • Microbit ideas
    • More
  • Self test
    • 01 Random topics
    • 02 Programming
    • 03 Data
    • 04 Computers
    • 05 Communication and the internet
    • 06 The bigger picture
    • 07 Paper 2