Topic 1 - Python Fundamentals Flashcards

1
Q

“Print” is known as a ____ in python

A

Function

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

In python, what is “ 2 + 2” known as?

A

An expression

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

What is required to make an expression in Python?

A

Expression = values + operators

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

List the order of operations

A
  1. ) Parentheses
  2. ) Exponents
  3. ) Multiplication / Division
  4. ) Addition / Subtraction
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

DATA TYPES:

  1. A whole number is known as what in python?
A

An Integer or “ints”

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

DATA TYPES:

  1. A number with a decimal point is known as what in python?
A

A float

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

DATA TYPES:

  1. Standard text in python is known as what?
A

Strings

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q
  1. Adding two strings together using a plus symbol is known as what in python?
A

String concatenation

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

If you wanted to repeat a string multiple times, you would use “string replication”.

How would you write “Alice” three times?

A

“Alice” * 3

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

Describe what a variable is?

A

A variable is like a box that can store a value, such as a number.

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

What function would you use to find the length of a variable and what would it return?

A

len(my_name)

It would return an integer value.

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

What is input() in the following code example known as in python?

name = input()

A

A function

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

Why might you have to call the “str” function on an integer

A

In a print statement, you may need to convert between data types, such as converting a integer to a string.

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

How can you convert a string of “1234” into an integer.

A

Use the function - int(“1234”)

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

What will happen if you try concatenate an integer and a string?

Example - 27 + “years old”

A

This would produce an error. The solution would be to first convert the integer to a string.

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