ENCMP 100 - TOPIC 2

0.0(0)
studied byStudied by 0 people
0.0(0)
full-widthCall with Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/15

encourage image

There's no tags or description

Looks like no tags are added yet.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced
Call with Kai

No study sessions yet.

16 Terms

1
New cards

What is input in programming?

Data that enters a program (often from the keyboard/user).

  • Stuff you type into the program (Spyder Script)

2
New cards

What does input() do?

Reads one line from standard input (keyboard) and returns it.

  • Data that enters a program (often from the keyboard/user)\

  • Stuff that you type into the program

3
New cards

What type does input() return by default?

A string

4
New cards

What does print() do?

Displays output to the standard output (console)

  • Stuff the program shows you

5
New cards

What does sep do in print()?

sets the separator between items

  • what goes between things

6
New cards

What does end do in print()?

sets what prints at the end

  • what happens at the end

7
New cards

Syntax Error

Python/Spyder can’t run at all

  • program never starts

8
New cards

Types of Syntax Errors

  1. Miss-capitalization

  2. Leaving out quotes

  3. Mismatching quotes

  4. Not matching brackets

9
New cards

Syntax Error: Miss-capitalizing a word

Using the wrong letter case for Python keywords or functions

  • ex) Print("Hello World!")

    • “Print” is not defined

    • Must be “print”

10
New cards

Syntax Error: Leaving out quotes

Texts must be enclosed in quotation marks; missing out causes an error.

  • ex) print("Hello World!)

    • Missing the last “ after !

    • This string never ends

11
New cards

Syntax Error: Mismatching quotes

A string must start and end with the same type of quotation mark

  • ex) print("Hello World!')

    • “ does not match with ‘

12
New cards

Syntax Error: Not matching brackets

Every opening bracket or parenthesis must have a corresponding closing one

  • ex) print("Hello"

    • Missing )

13
New cards

What is a logic (runtime) error?

An error that occurs while the program is running, even though the syntax is correct

  • Python understands your code, but something goes wrong when it runs

14
New cards

Types of Logic (Runtime) Errors

  1. Dividing by zero

  2. Wrong output (typo/wrong logic)

  3. Forgetting to output something

  4. Using the wrong calculation or operation

15
New cards

Logic (Runtime) Error: Dividing by zero

The p

16
New cards