Python comes pre-installed on Linux OS. For Windows you will have to Download. Download Python here
Use a text-editor of your choice:
Recommended are:
Visual Studio Code Atom Sublime Text
Note that you have to pass the challenges in git and github to proceed to the next stages. They are essential tools in development for code sharing and collaboration.
Raise an Issue if encountering a blocker
-
The print function allows you to send output to the terminal
Strings can be enclosed in single quotes or double quotes
- "this is a string"
- 'this is also a string'
The input function allows you to prompt a user for a value
Parameters:
prompt: Message to display to the user
return value:
- string value containing value entered by user
-
Python can store and manipulate numbers. Python has two types of numeric values: integers (whole numbers) or float (numbers with decimal places)
When naming variables follow the PEP-8 Style Guide for Python Code
Converting to numeric values
-
Python can store and manipulate strings. Strings can be enclosed in single or double quotes. There are a number of string methods you can use to manipulate and work with strings
Converting to string values
When naming variables follow the PEP-8 Style Guide for Python Code
-
The datetime module contains a number of classes for manipulating dates and times.
Date and time types:
datestores year, month, and daytimestores hour, minute, and seconddatetimestores year, month, day, hour, minute, and secondtimedeltaa duration of time between two dates, times, or datetimes
When naming variables follow the PEP-8 Style Guide for Python Code
Converting from string to datetime
-
Error handling in Python is managed through the use of try/except/finally
Python has numerous built-in exceptions. When creating
exceptblocks, they need to be created from most specific to most generic according to the hierarchy. -
Conditional execution can be completed using the if statement
ifsyntaxif expression: # code to execute else: # code to execute
- < less than
- < greater than
- == is equal to
- >= greater than or equal to
- <= less than or equal to
- != not equal to
-
Conditional execution can be completed using the if statement. Adding
elifallows you to check multiple conditionsifsyntaxif expression: # code to execute elif expression: # code to execute else: # code to execute
- x or y - If either x OR y is true, the expression is executed
- < less than
- < greater than
- == is equal to
- >= greater than or equal to
- <= less than or equal to
- != not equal to
- x in [a,b,c] Does x match the value of a, b, or c