17/01/2024 - Recap Flashcards

1
Q

how do you create a list

A

list = []

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

what can a list contain?

A

mixed types

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

How do you index and slice lists?

A

The same a strings

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

Are lists mutable or immutable?

A

Lists are mutable

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

Get the largest or smallest of two values

A

max(va1, val2) or min(val1, val2)

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

Decimal part of a division

A

Modulus operator ‘%’ 1 % 2

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

whole number part of a division

A

math floor operator math.floor(1/2) or 1//2

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

What is black

A

A python formatter. Formats files in place

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

What is poetry

A

A tool for dependency management and packaging

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

What is poe

A

A task runner for poetry.

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

What is jinga

A

A web template engine. Similar to django

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

What is linting and name a linting tool

A

Flake8 is a linting tool. It checks your code base for errors, styling issues and complexity

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

What is pep?

A

Python enhancement proposals

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

What is pep8?

A

Pep8 is a style guide for python code

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

What pytest?

A

A python testing framework

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

What are the advantanges of python?

A

Easy to read and learn
Reduces maintenance costs
Easy Memory Management
Wide applicability
Large community
Easy integration with other programming languages
Asynchronous coding
Portable
Enterprise Application Integration

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

What are the disadvantages of python?

A

Slow execution speed
Large memory consumption
Not ideal for mobile and game development
Addiction to easy coding
Weak database access
Design restrictions
More prone to runtime errors

18
Q

what type of language is python?

A

A dynamically typed language. Type-checking is performed at runtime. It’s also an interpreted language, which run slower than compiled code.

19
Q

What are python collections?

A
20
Q

What are iterators?

A
21
Q

What are list comprehension s?

A
22
Q

What is the name of the OOD principles?

A

SOLID

23
Q

What are the solid principles?

A

Single responsibility
Open-closed
Liskov Substitution
interface segregation
Dependency inversion

24
Q

What is dynamically typedvs statically typed?

A
25
Q

What does “hello”+”you” produce

A
26
Q

WHat happens with “hello”*4

A
27
Q

what happens with “hello” - “ello”?

A
28
Q

what types of comments are there?

A
29
Q

How is a multiline string pinted?

A
30
Q

How many Python keywards are there?

A
31
Q
A
32
Q

What’s the difference between parameters and arguments?

A

Arguments are passed to functions and parameters are the variables in the function declaration between the parentheses

33
Q

What are fixtures?

A

Fixtures are functions that can be used to manage our apps states and dependencies. Often used with pytest

34
Q

What can you do with string slicing and give examples

A
35
Q

What is recursion

A
36
Q

What are factory methods?

A
37
Q

What does enumerate do and return?

A
38
Q

What are the common python data structures, and what are their methods?

A
39
Q

What is integer division?

A

Also known as floor division 3 // 2
Which equals 1

40
Q

What is cpython

A