Intro to Python Flashcards

(25 cards)

1
Q

What is Python?

A

A beginner-friendly, high-level programming language used for apps, automation, data, AI, and more.

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

Does Python care about capitalization?

A

Yes, it is case-sensitive.

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

What is syntax?

A

The rules for how code must be written to run correctly.

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

What does print() do in Python?

A

Displays text or values in the output.

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

How do you make Python display hello?

A

print(“hello”)

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

What does input() do?

A

Takes user input and stores it as text.

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

What type of data does input() always return?

A

A string.

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

How do you store user input in a variable?

A

name = input(“Enter name: “)

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

What is a variable in Python?

A

A labeled container that stores data.

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

How do you assign the number 5 to a variable named x?

A

x = 5

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

What are lists in Python?

A

Ordered collections that can store multiple values.

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

How do you make a list of 3 numbers?

A

nums = [1, 2, 3]

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

Do lists start counting from 0 or 1?

A

0 (zero-based indexing).

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

How do you access the first item in a list named food?

A

food[0]

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

What is an if statement used for?

A

Running code only when a condition is true.

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

Write a basic if statement checking if x is greater than 10.

A

if x > 10:
print(“x is big”)

17
Q

What does else do?

A

Runs when the if condition is false.

18
Q

What is a loop?

A

Code that repeats automatically.

19
Q

What kind of loop repeats a set number of times?

20
Q

Write a for loop that prints 0 to 2.

A

for i in range(3):
print(i)

21
Q

What does range(5) produce?

A

The numbers 0 through 4.

22
Q

What loop repeats while a condition is true?

A

A while loop.

23
Q

What symbol is used to start a code block in Python (after if, loops, functions)?

24
Q

What is indentation in Python?

A

Spaces at the start of a line that define code blocks.

25
Will Python run if indentation is inconsistent?
No, it will throw an error.