Chapter 2 - Glossary Flashcards

1
Q

Variable

A

A variable is a name that refers to a value.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Expression

A

An expression is a combination of values, variables, and operators

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

> > > n + 25

Is this correct.

A

Yes this this display the value of n+25 in interactive mode.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Difference Between Python Interactive mode and script mode.

A

> > > miles = 26.2
miles * 1.61
42.182Python Interactive mode is when we run python code from the python terminal. In interactive mode, we don’t want to type print expression, only a variable name is sufficient to print the value of a variable. Script mode is when we save python code in the file as .py extension

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Order of Operations

A

PEMDAS - Order of Precedence
Equal precedence operators evaluated left to right
Multiply & Divide has same precedence
Add & Subtract also has same .

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Which Operators works on string.

A
\+ and * works on strings
a = 'Hemant'
b = ' Kumar'
print(a+b)
c = 'Bye '
print(c * 4)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Types of Errors in a Program ?

A

Syntax Errors
Runtime Errors
Semantic Errors

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Assignment

A

A statement that assigns a value to a variable.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Keyword

A

A reserved word in programing language

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Expression

A

Expression is a combination of variables, operations and values that yields a result value.

5 * 5 # yields 25

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Statement

A

Statements represent an action or command e.g print statements, assignment statements.

print ‘hello’, x = 1

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Execute

A

To run a statement and do what it says.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Interactive Mode

A

A way of using the Python interpreter by typing code at the prompt.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Script Mode

A

A way of using the Python interpreter to read code from a script and run it.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Order of Operations

A

Operator Precedence table

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Concatenate

A

To join two strings or operands

17
Q

Semantic Error

A

An error in a program that makes it do something other than what the program‐
mer intended.

18
Q

Semantics

A

The meaning of a program.

19
Q

How about x = y = 1?

A

True statement.

It creates two variables x & y and assign value 1

20
Q

In some languages every statement ends with a semicolon, ;. What happens if
you put a semicolon at the end of a Python statement?

A

Semicolon works as an indentation in Python.