- What is Python?
- Python is an Interpreted language
- Python Resources
- Text Editors
- How to Program
- Comments
- Extra (depending on time)
- Simple Operators in Python
- Python is a general-purpose programming language that can be used to:
- develop web apps and software
- write scripts to automate operations within operating systems
- operate robots and other technical machinery
- … and more!
- Python is one of many languages in Data Science and Machine Learning. It is by far the most popular.
- Python is easy to learn, read and write.
- There are extensive scientific computing libraries and published academic work that uses Python
- Easy, cross-platform, share-able
- The minimum necessary for you to get some code working
- Interpreted languages are translated into machine code and run at the same time, giving immediate output.
- In repl.it, you can just hit the “Play” button and see results
- Interpreted languages: Javascript, Ruby, LISP, many other
- Python Documentation
- Pep 8 Style Guide
- Try using Google first, before asking peers or instructors , for example:
- Practice on CodeWars.com
- Text editors are used to write plain text (using UTF-8 encoding)
- DSI and Galvanize courses use VSCode primarily, please install it ASAP
- Install Anaconda for your operating system, giving you access to Jupyter notebooks and a local Python environment
- Think about the problem
- Define what it means for the program to be working
- Create a series of formal steps that lead to a repeatable operation
- Define the steps clearly and at an appropriate level for an extra-terrestrial with good human language skills, who has never cooked pasta before
- There is no single correct solution here
- Gather cooking implements and supplies a. Take Boiling Pot out of cupboard under the counter b. Take Box of Spaghetti out of cupboard next to refrigerator c. Take Salt from spice rack d. Take oil from shelf next to stove
- Prepare water for boiling pasta a. Fill Boiling Pot with water from the tap b. Place Boiling Pot on stove burner c. Turn heat dial clockwise so that it is on high ...
# this is a single line comment
'''
This
is a
multi-line
comment
'''
- Send a message to someone reading your code
- Exclude some code snippet from running
- Provide function documentation
- Leave
# TODO:
statements in your code, for later development
- Common Data Types
- Simple Operators in Python
- Assignment Operators
-
A data type can be thought of as a form in which a piece of data can exist
- Working with integers, floats, booleans
-
the
type()
function will tell you the data type- ex:
type(23)
will tell you that 23 is an integer
- ex:
- Integers can be thought of as “whole numbers”
- Floats can be thought of as “decimal numbers”
- Ints and floats are encoded differently
1.0 == 1
?? ⇒True
- However,
type(1.0) == type(1)
?? ⇒False
- Use the
type()
function to discover the type of the number74
. - Using a comment, describe simply what you did on the line above your code snippet
# output to console the type of 74
print(type(74))
NOTE: In general, you will want to avoid writing comments that say what your code is doing, unless, at this stage, it is for your own benefit and study
- Basic Arithmetic Operators:
Addition:
+
Subtraction:-
Multiplication:*
Division:/
- PEMDAS
- Use parentheses
(3+5) / 7
to ensure the desired order of operations
- Use parentheses
- Python is a “duck typed” language
- "If it walks like a duck, and quacks like a duck, then it must be a duck."
- Effectively, this means that you can perform mathematical operations between similar types, such as ints and floats, because Python infers a general type for the operation.
- For example, operations between ints and floats will result in floats
- Division will result in a float
- Add 5 and 7.2, multiply the result by 6, divide that result by 3, then square the result
- Add 5 and 7.2, multiply the result by 6, divide that result by 3, then square the result
print((((5 + 7.2) * 6) / 3)**2)
- Read through the Welcome to Data Science Prep Section
- Read the first 3 units in Introduction to Python
- Welcome to Python
- About Python Programming
- Complete all the challenges in Python Basics
- Install VSCode
- Set up a GitHub account http://github.com
- Share your github username
- Follow clownfragment and clarkwalker
- Set up a CodeWars account at http://codewars.com