Python

0.0(0)
Studied by 0 people
call kaiCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/22

encourage image

There's no tags or description

Looks like no tags are added yet.

23 Terms

1
New cards

Conceptually, how does Python describe a variable?

Variables are described as labeled boxes used for storing and referencing data of different types.

2
New cards

What is the correct syntax for declaring a variable in Python?

Write the variable name on the left, followed by the assignment operator (==), and the value to store on the right (for example: age = 25).

3
New cards

What is a string in Python, and how must it be written?

A string is a series of characters used to represent text, written enclosed in single quotes (e.g., 'Hello') or double quotes (e.g., "Hello").

4
New cards

What characters can a Python variable name start with?

A variable name can only start with a letter or an underscore (_\_), never with a number.

5
New cards

What characters are allowed to be used anywhere within a Python variable name?

Letters (a-z\text{a-z}, A-Z\text{A-Z}), digits (0-90\text{-}9), and underscores (_\_).

6
New cards

How does Python handle casing in variable names such as age, Age, and AGE?

Variable names are case-sensitive, meaning age, Age, and AGE are all treated as separate, unique variables.

7
New cards

Can Python reserved keywords (such as if, class, or def) be used as variable names?

No, variable names cannot use Python reserved keywords.

8
New cards

What error will Python raise if a variable name begins with a number (such as 5variable_name = 5)?

Python will raise a SyntaxError: invalid syntax.

9
New cards

What is snake case, and how is it used in Python variable naming?

Snake case is the convention of writing variable names in lowercase with words separated by an underscore (for example, my_variable_name).

10
New cards

Why is user_age preferred over age or an abbreviation like ua?

Descriptive variable names clearly communicate their purpose to other team members and your future self within a large codebase.

11
New cards

Why should single-letter variable names be avoided?

They should be avoided because they communicate no purpose or meaning.

12
New cards

How are single-line comments defined in Python, and how does Python process them?

Comments begin with a pound symbol (#\#); Python ignores the symbol and all text following it on that line.

13
New cards

How can multi-line comments be created in Python?

By using consecutive single-line comments, each starting with the pound symbol (#\#).

14
New cards

What should be used instead of comments to clarify what a variable represents?

The variable names themselves should be chosen descriptively to communicate what they are for, rather than relying on comments to explain them.

15
New cards

What type of programming language is Python, known for its simplicity and flexibility?

general-purpose

16
New cards

What visual outputs do data scientists create using Python after cleaning data and identifying patterns?

charts

17
New cards

In addition to data analysis, what type of models is Python widely used to build and train?

machine learning

18
New cards

In web development, what category of tasks (such as managing user accounts and form submissions) does Python handle?

server-side tasks

19
New cards

What routine evaluations do cybersecurity professionals use Python to automate when analyzing threats?

security scans

20
New cards

Because Python runs effectively on microcomputers, which type of hardware and connectivity projects is it well-suited for?

IoT (Internet of Things)

21
New cards

In DevOps and system administration, what operational records does Python help process alongside automating deployments?

logs

22
New cards

Which routine communication task is commonly automated using Python, along with managing files and reading spreadsheets?

emails

23
New cards

Along with being simple and flexible, what third key characteristic makes Python an ideal language to learn?

it is popular