Python Flashcards

1
Q

Describe Python

A

High Level language
Easy to start and read
Can be procedural, functional, and object oriented
Interpreted language (not compiled)
Dynamically typed
Code is portable and not platform independent
Huge user base
Lots of frameworks and tools/libraries
Particularly popular with machine learning

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

What are type hints

A

Helps to document your code
Help catch certain errors
improve IDEs and linters
Doc strings aren’t helpful to linters and there’s no strict standard
Not a great idea for small throwaway scripts as there’s a performance hit and it adds developer time
Worth it if your writing unit tests and have a large code base
use <var>: <type>
used in parameters and return types</type></var>

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

How do you display the python search path

A

import sys
print(sys.path)pwddd

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

What data structures are mutable and which ones are immutable?

A

Mutable : Dictionaries, lists, sets
Immutable: Tuples, Strings

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