Module 2.1 Introduction to Python 3

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

1/58

flashcard set

Earn XP

Description and Tags

Programming Basics

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

59 Terms

1
New cards

Computer Program

Set of instructions executing sequentially

2
New cards

Input

A program takes in data from a file, keyboard, touchscreen, network, etc. for computation

3
New cards

Process

A program performs computations on input data, such as adding two values like x+y

4
New cards

Output

A program puts that data somewhere, such as to a file, screen, or network

5
New cards

Variables

Containers that store values that vary as programs are able to update these containers with new values

6
New cards

Flowchart

A graphical language for creating or viewing computer programs and how they operate

7
New cards

Statements

In a program, there is a list of statements that carries out some action and is executed sequentially

8
New cards

Interpreter

A computer program that directly executes (runs) instructions (statements) written in a program

9
New cards

Character

Any letter (a-z, A-Z), digit (0-9), space, or symbol (~,!,@,etc.)

10
New cards

String literal

Text characters within double quotes (“this is a string”)

11
New cards

Newline

Special two-character sequence \n whose appearance in an output string literal causes the cursor to move to the next output line

12
New cards

Pseudocode

Text that resembles a program in a real programming language, but is simplified to human understanding

13
New cards

Integrated Development Environment (IDE)

Environment where code development is done

14
New cards

Scripting Languages

Languages that allow programs to execute without the need for compilation

15
New cards

Script

A program whose instructions are executed by another program called an interpreter

16
New cards

Python

A scripting language created by Guido Van Rossum that was designed for simplicity and readability, while providing as much power and flexibility as other scripting languages like Perl

17
New cards

open-source language

the community of users participate in defining the language and creating new interpreters

18
New cards

Python Interpreter

A computer program that executes code written in the Python programming language

19
New cards

Interactive Interpreter

A program that allows the user to execute one line of code at a time

20
New cards

Code

Textual representation of a program

21
New cards

Line

Row of text

22
New cards

Prompt

The statement “>>>” is displayed by the interactive interpreter to indicate code is ready to be processed

23
New cards

Expressions

code that returns a value when some computation is performed using variables

24
New cards

Assignment

storing a value to a variable using “=”

25
New cards

print()

function that displays variables or expression values

26
New cards

Comments

statements used to explain portions of code to a human reader

27
New cards

Syntax Error - definition

An error made when violating a programming language’s rules in implemented statements that are combined to create a program

28
New cards

Syntax Error - occurance

The interpreter will create a message when encountering a syntax error, that will report the line number where the issue is located, and provides the programmer information as to what type of error is occurring

29
New cards

Runtime Errors

A program’s syntax may be correct, but the program attempts an impossible operations, such as dividing by zero or multiplying strings together

30
New cards

Crash

A runtime error stops the execution of the program and the abrupt termination of a program

31
New cards

Logic Error

A part of the written program is logically flawed and results in bugs, which is a logic error that occurs when the desired output of the program differs from the actual output of the program

32
New cards

Indentation Error

The lines of the program are not properly indented

33
New cards

Value Error

An invalid value is used

34
New cards

Name Error

The program tries to use a variable that does not exist

35
New cards

Type Error

An operation uses incorrect types

36
New cards

A logic error is often called a bug

True

37
New cards

The Python interpreter is a computer program that executes code written in the Python programming language.

True

38
New cards

The input obtained by input() is any text that a user typed, including numbers, letters, or special characters like # or @. Such text in a computer program is called a string.

True

39
New cards

Programs commonly get input values, then perform some processing on that input and then put output values to a screen or elsewhere.

True

40
New cards

Expressions

__________ are code that return a value when evaluated; for example, the code wage * hours * weeks is an expression that computes a number. The symbol * is used for multiplication.

41
New cards

Whitespace

Any space, tab, or newline is called __________________.

42
New cards

Variable

In Python, a new __________ is created by performing an assignment using the = symbol, such as salary = wage * hours * weeks.

43
New cards

Text in string literals may have letters, numbers, spaces, or symbols like @ or #.

True

44
New cards

Syntax errors are found before the program is ever run by the interpreter.

True

45
New cards

Programming is largely about problem solving: Creating a methodical solution to a given task.

True

46
New cards

Print()

the __________ function displays variables or expression values.

47
New cards

Type

Strings and integers are each an example of a __________, which determines how a value can behave.

48
New cards

Compared to flowcharts, pseudocode may be easier to create (just by typing) and to share than graphics.

True

49
New cards

String Literal

Text enclosed in quotes is known as a(n)

50
New cards

Most coding activities strictly require a student program's output to exactly match the expected output, including whitespace.

True

51
New cards

A program can have variables, each being a name that can hold a value, like a variable x holding the value 7.

True

52
New cards

The interpreter will generate a message when encountering a syntax error.

True

53
New cards

In Python, the value of a variable can be printed out via: 

print(variable_name) (without quotes).

True

54
New cards

Algorithm

A sequence of instructions that solves a problem is called a(n)

55
New cards

input()

In Python, reading input is achieved using the __________ function.

56
New cards

In Python, a programmer can add end=' ' inside of print() to keep the output of a subsequent print statement on the same line separated by a single space. Ex: print('Hello', end=' ')

True

57
New cards

Just because the program loads and executes does not mean that the program is correct.

True

58
New cards

In Python, each call to print() generally outputs on a new line.

True

59
New cards

Adding a string inside the parentheses of input() displays a prompt to the user before waiting for input and is a useful shortcut to adding an additional print statement line.

True