Advanced Python Flashcards
What do generators do?
They yield information back.
Since they do not return, they’re able to keep track of current variables.
The __init__ function is called automatically when a new class is instantiated.
True
What is Python?
Python is a high-level, interpreted, general-purpose programming language. it can be used to build almost any type of application with the right tools/libraries.
What is PEP 8 and why is it important?
PEP stands for Python Enhancement Proposal. is an official design document providing information describing a new feature for Python.
What is a dynamically typed language?
Type-checking can be done at two stages -
Static - Data Types are checked before execution.
Dynamic - Data Types are checked during execution.
What are the benefits of using Python?
Python is a general-purpose programming language that has a simple, easy-to-learn syntax that emphasizes readability and therefore reduces the cost of program maintenance.
What is lambda in Python? Why is it used?
Lambda is an anonymous function in Python, that can accept any number of arguments, but can only have a single expression.
It is used in situations requiring an anonymous function for a short time period.
What is the difference between Python Arrays and lists?
Arrays in python can only contain elements of same data types and consumes far less memory than lists.
Lists in python can contain elements of different data types consuming large memory.
What is slicing in Python?
Syntax for slicing is [start : stop : step]
start is the starting index from where to slice a list or tuple
stop is the ending index or where to sop.
step is the number of steps to jump.
Default value for start is 0, stop is number of items, step is 1.
Slicing can be done on strings, arrays, lists, and tuples.
What is an Interpreted language?
An Interpreted language executes its statements line by line.