How do you check which version of Python editor you have?
1
,Page 2 of 60
import sys
print(sys.version)
How do you edit, save, and run a Python file?
edit = can edit in a text editor
save = save as file.py
run = in command prompt, type file.py
Can you run Python in the Command Line?
type python or py
you will see Python version information and >>>
when you are finished, type exit( )
What is unique about Python script formatting?
relies on indentation (whitespace) to define scope instead of curly brackets
Which Python datatypes are used to store arrays?
list, tuple, set, and dictionary
Which Python datatypes allow arrays with duplicates?
list and tuple
Which Python datatypes are for ordered arrays?
2
,Page 3 of 60
list, tuple, dictionary
Which Python datatypes are unchangeable?
tuple and set
What kind of variable would x = [ ] result in?
list
How do you determine how many items are in a list?
print(len(yourlist))
What are some characteristics of a list?
ordered; changeable; allows duplicate values; new values added to the end of the list; indexed
(first value if 0, second value is 1, etc.); values can be any datatype (and a mix of datatypes)
What are some characteristics of a tuple?
ordered; unchangeable; allows duplicate values
What are some characteristics of a set?
unordered; unchangeable (you can add or remove items, but you cannot change an item);
unindexed
What are some characteristics of a dictationary?
3
, Page 4 of 60
ordered; changeable; no duplicates
print(10 > 9)
print(10 == 9)
print (10 < 9)
Boolean
print(bool("Hello"))
print(bool("15"))
print(bool(x))
Boolean examples of True
print(bool(False))
print( )
print(0)
Boolean examples of False
print(isinstance(x, int))
determine if an object is of a certain data type
int( )
casts an integer from an integer literal, float literal, or string literal
4
The benefits of buying summaries with Stuvia:
Guaranteed quality through customer reviews
Stuvia customers have reviewed more than 700,000 summaries. This how you know that you are buying the best documents.
Quick and easy check-out
You can quickly pay through credit card or Stuvia-credit for the summaries. There is no membership needed.
Focus on what matters
Your fellow students write the study notes themselves, which is why the documents are always reliable and up-to-date. This ensures you quickly get to the core!
Frequently asked questions
What do I get when I buy this document?
You get a PDF, available immediately after your purchase. The purchased document is accessible anytime, anywhere and indefinitely through your profile.
Satisfaction guarantee: how does it work?
Our satisfaction guarantee ensures that you always find a study document that suits you well. You fill out a form, and our customer service team takes care of the rest.
Who am I buying these notes from?
Stuvia is a marketplace, so you are not buying this document from us, but from seller eddietaylor. Stuvia facilitates payment to the seller.
Will I be stuck with a subscription?
No, you only buy these notes for $27.99. You're not tied to anything after your purchase.