Week 6 - Python Flashcards
How to run a Python program?
python programName.py
What are some of biggest differences between Python and C that make Python way cleaner?
- No semicolons at the end of lines
- No curly braces on blocks
- No parenthesis on conditionals
- No type mentioning on vars. declarations/initilializations
How to declare a function on Python?
def functionName()
What should always be the very last line of code of any Python program?
Main call - main()
What’s the downside of Python being so much easier to program than C, i.e.?
Expense of performance, because of so many functions running in the background
What’s the comments markup in C?
#
What are the loops that can be used in Python?
While loops and for loops
What are lists in Python?
Arrays
What’s the biggest advantage of Python’s lists?
They’re not size fixed
What’s the lists markup on Python?
Square brackets
What are tuples?
They’re a data type in Python similar to C’s structs, but they have inmutable values
What are objects in Python?
They’re similar to C structs
Why styling is even more important in Python?
Because if tabs and indentation are not used things may not work as intended
import fileName in Python is the equivalent to what in C?
include <file_name></file_name>
What should be used instead of || and && operators in Python?
Or/and