Back to 课程

Computer Science GCES EDEXCEL

0% Complete
0/0 Steps
  1. Decomposition And Abstraction Edexcel
    2 主题
  2. Algorithms Edexcel
    11 主题
  3. Truth Tables Edexcel
    3 主题
  4. Binary Edexcel
    6 主题
  5. Data Representation Edexcel
    4 主题
  6. Data Storage And Compression Edexcel
    2 主题
  7. Hardware Edexcel
    5 主题
  8. Software Edexcel
    3 主题
  9. Programming Languages Edexcel
    2 主题
  10. Networks Edexcel
    7 主题
  11. Network Security Edexcel
    2 主题
  12. Environmental Issues Edexcel
    1 主题
  13. Ethical And Legal Issues Edexcel
    3 主题
  14. Cybersecurity Edexcel
    2 主题
  15. Develop Code Edexcel
    6 主题
  16. Constructs Edexcel
    4 主题
  17. Data Types And Data Structures Edexcel
    5 主题
  18. Operators Edexcel
    1 主题
  19. Subprograms Edexcel
    2 主题
课 Progress
0% Complete

Exam code:1CP2

What is an algorithm?

  • An algorithm is precise set of rules or instructions to solve a specific problem or task

  • There are two main ways to write an algorithm

    • Flowchart

    • Pseudocode

Flowcharts

What is a flowchart?

  • Flowcharts are a visual tool that uses shapes to represent different functions to describe an algorithm

  • Flowcharts show the data that is input and output, the processes that take place and any decisions or repetition

  • Lines are used to show the flow of control

flow-chart-symbols

Example

Flowchart

flow-chart-1
  • The casino would like the algorithm refined so that the user also enters their first name and this is used to greet the user when they access the site

Flowchart

flow-chart-2-1

Pseudocode

What is pseudocode?

  • Pseudocode is a text-based tool that uses short English words/statements to describe an algorithm

  • Pseudocode is more structured than writing sentences in English but is very flexible

  • In exams, pseudocode will appear in the format of Python 3 as per the Programming Language Subset (PLS) document from Edexcel (opens in a new tab)

Example

  • A casino would like a program that asks users to enter an age, if they are 18 or over they can enter the site, if not then they are given a suitable message

Pseudocode

age = int(input("Enter age "))
if age >= 18: print("Welcome to the site")
else: print("Sorry, this site is for users 18 and over"
  • The casino would like the algorithm refined so that the user also enter their first name and this is used to greet the user when they access the site

Pseudocode

fname = input("Enter first name ")
age = int(input("Enter age")
if age >= 18: print ("Welcome to the site" + fname)
else: print ("Sorry, this site is for users 18 and over")

Responses

您的邮箱地址不会被公开。 必填项已用 * 标注