Programming

0.0(0)
studied byStudied by 4 people
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/29

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

30 Terms

1
New cards

Programming

  • Telling a computer what to do

  • Giving the computer instructions to carry out

2
New cards

Syntax for print

  • print(‘Text’)

  • print(“Text”)

Starts in single: must end in single

Starts in double: must end in double

3
New cards

Types of errors

  • Syntax

  • Logical

  • Runtime

4
New cards

Syntax Errors

  • Errors in how the code is written

  • Doesn't adhere to the rules

5
New cards

Logical Errors

  • Also called semantic errors

  • Does not output what was intended

  • Error in calculation/process

6
New cards

Runtime

  • Cause the program to terminate

  • Examples

    • dividing by 0

    • Infinite loop

    • Incorrect input by the user

7
New cards

Variable

A value that is given a name and can be changed

8
New cards

String

A piece of text

9
New cards

An integer

A whole number

10
New cards

Floating-Point Number

A number with a decimal point

11
New cards

Syntax for input

Name=input(“Prompt”)

12
New cards

Syntax for integer input

Integer=int(input(“Prompt”))

13
New cards

Arithmetic Operation Syntax

answer=num1+num2

14
New cards

To perform a math operation, convert input into

int() or float()

15
New cards

Input

Read from the keyboard

16
New cards

Print

Display to the screen

17
New cards

If

Check a condition to see which operations to perform

18
New cards

=

Assign a value to a variable

19
New cards

While

Perform actions repeatedly

20
New cards

Syntax for Lists

List_name = [“item1”, “item2”, “item3”]

21
New cards

Lists

A type of data structure

22
New cards

Data Structure

Data structures are organised collections of data

23
New cards

Data is organised in ___________________

A sequence, with each item having a unique index

24
New cards

Index

Tells you the position of each item in a list

25
New cards

IndexError

This occurs when an index number that doesn't exist gets called

26
New cards

Position

Index + 1

27
New cards

Syntax to find number of items on a list

len(name of list)

28
New cards

Syntax to find the index of a list item

number = listname.index(“object”)

29
New cards

Iterative Structure

  • Used when a program needs to repeat a block of code

  • Needed when a program needs to repeat actions

30
New cards

While Loop

Repeats actions while a condition is true