Python Flashcards
What is Python?
Python is a high-level, general-purpose object oriented programming and scripting language.
What is a High-Level programming language?
A High-Level programming language is a language that has a lot Abstraction from the details of the computer. For example it will simplify or automate tasks such as Memory Management opposed to a low-level language that is usually less readable and requires direct code for dealing with the details of the computing system. Low and High are used to describe high abstraction and low abstraction.
How is a python variable declared?
variable = variable_value
what does the \ do in this statement:
‘Hi, I'm Anthony’
It is used to escape string and use a special character ( ‘ ) the example could also be written “Hi I’m Anthony” because double quotes were used around the string.
How do you create a single line comment in python?
By using the pound (hash) symbol.
How do you create a multiple line comment in Python?
”"”You start it with the quotation marks followed by the comment and then end the multi line comment with three more quotation marks”””
What does len( ) do?
len ( ) is a method that returns the string length of the string (including spaces) or variable storing a string that is passed to it.
What does upper( ) do?
It convert a string or variable storing a string to uppercase. It is written like this
“eggs”.upper( )
That would return “EGGS”
what does lower( ) do?
It converts a string or variable storing a string to lowercase. It is written like this:
“SpAm”.lower( )
that would return “spam”
What does str( ) do?
It converts what ever is passed to it into a string (accept variable names). it is written like this:
str(2.13)
Would return “2.13”
Why does lower( ) and upper( ) use dot notation?
lower( ) and upper ( ) are unique to strings so they use string literals where as len( ) and str( ) can be passed object that are not strings.
what does print do?
Print outputs the what it is passed to the console from the interpreter.
How do you concatenate string in python?
By using the plus sign (+).
“hello “ + “world”
what are PEPs?
Python Enhancement Proposals
What is the keyword to create a function?
def