Course Content
Introduction to Python
Introduction to Python
2. Variables and Types in Python
How to Store Numbers in PythonPython Naming Rules for VariablesHow to Work with Variables in PythonData Types in PythonChallenge: Converting Kilometers to MilesStore Text with Strings in PythonString Indexing in PythonNegative Indexing and String Length in PythonString Slicing in PythonChallenge: Retrieving Letters from StringString Concatenation in Python
3. Conditional Statements in Python
Boolean Data Type in PythonChallenge: Working with Comparison OperatorsHow to Combine Conditions in PythonChallenge: Working with Logical OperatorsMembership Operators and Type Comparisons in PythonHow to Use if/else Expressions in PythonChallenge: Running a Grocery StoreChallenge: Creating Odd and Even Logicif/elif/else ExpressionsChallenge: Running Grocery Store ExtendedChallenge: Outputting Positive, Negative or Zero
4. Other Data Types in Python
Python ListsCommon List Methods in PythonChallenge: Updating ListNested Lists in PythonChallenge: Retrieving Information from Nested ListPython TuplesCommon Tuple Methods in PythonChallenge: Updating TupleNested Tuples in PythonChallenge: Retrieving Information from Nested TuplePython DictionariesChallenge: Completing DictionaryCommon Dictionary Methods in PythonChallenge: Updating Dictionary
6. Functions in Python
Built-in Functions in PythonChallenge: Converting HeightsHow to Create Functions in PythonsChallenge: Writing First FunctionUse of if/else Statements in Python FunctionsChallenge: Identifying Positive Values Functions Without Return in PythonChallenge: Creating Logging FunctionModifying Functions in PythonChallenge: Updating Logic of the FunctionLambda Functions in PythonChallenge: Creating Lambda Function
Handle More Challenging Math in Python
Python provides several additional math operations.
# Default division print(18 / 4) # Floor division print(18 // 4) # Remainder of the division print(18 % 4) # Raising to the power of 4 print(18 ** 4)
Why Are These Operations Helpful?
Imagine you have $50 and want to buy as many cookie packs as possible, with each pack costing $6. To determine how many packs you can buy and how much money will remain, you can use these operations:
50 // 6
gives8
, meaning you can buy 8 packs.50 % 6
results in2
, meaning you’ll have $2 left after the purchase.
Task
Swipe to start coding
- On the second line, compute the floor division of
234
by32
. - On the fifth line, determine the remainder when
356
is divided by17
.
Solution
Everything was clear?
Thanks for your feedback!
Section 1. Chapter 4
Handle More Challenging Math in Python
Python provides several additional math operations.
# Default division print(18 / 4) # Floor division print(18 // 4) # Remainder of the division print(18 % 4) # Raising to the power of 4 print(18 ** 4)
Why Are These Operations Helpful?
Imagine you have $50 and want to buy as many cookie packs as possible, with each pack costing $6. To determine how many packs you can buy and how much money will remain, you can use these operations:
50 // 6
gives8
, meaning you can buy 8 packs.50 % 6
results in2
, meaning you’ll have $2 left after the purchase.
Task
Swipe to start coding
- On the second line, compute the floor division of
234
by32
. - On the fifth line, determine the remainder when
356
is divided by17
.
Solution
Everything was clear?
Thanks for your feedback!
Section 1. Chapter 4