In the first lesson, we learn how the print() function works and write our first lines of code using the print() function. We will see the results of the print() command as output. Then, we will add an input() function which will prompt the user for an input and wait until an input is received before continuing.
You should view the vocab for this lesson in the Documents tab and work hard to commit the vocab to memory.
This is the solution code for the print() function assignment.
Lesson 1.2 uses the skills we covered in Lesson 1.1 and introduces variables, assignment operator, and concatenation.
Solution code for variables, assignment operator and concatenation assignment
This lesson defines a value and demonstrates how to concatenate string data. Also defined are data types (string, integer, float), and literals.
Solution for Lesson 1.4 assignment.
We review and contine with concatenation and include number input. Data type conversion is also practiced.
This lesson continues with concatenation of data values and demonstrates using number input in the concatenation of data values.
In this student activity, you will practice with creating varialbe assignments, creating varialbe assignments using inputs, print statments and data typecasting. You will also create a simple math calculation and print the results in a string.
Solution for Lesson 1.6, using variables, assignments, inputs, prints, typecasting
You may use any of the past coding exercises you have completed to help with this quiz. You may also use the Thonny IDE to write or copy code from the quiz to test it out. Lastly, feel free to use the Internet to search for answers or solutions.
Coding is not done in a vacuum and developing strong search skills and learning how to use additional resources to write code is fully acceptable.
This lesson explores expressions and uses mathamatical operators to begin creating simple calculations.
This is the solution code for Lesson 1.7 assignment.
This lesson shows how to typecast (change the data type) of an expression and uses math operators to do simple calculations.
Solution for typecasting an expression
This lesson defines and shows how to use the modulus operator (%)>
Solution for Lesson 1.9 modulus operator.
Unit 1 exam covers sections 1.1 through 1.9. Click on the Tests tab to access the exam.
Good luck.
This uint introduces the if statement. The if statement allows code to make comparisons and determine if some code should be skipped or not. The if statement is one of the most powerful and important coding tools we use.
This shows the solution for the assignment in Lesson 2.1, using the if-statement.
Here is an example of the if-clause and the introduction of the lesson assignment.
Solution for Lesson 2.1.1 Conditionals and if-clause
Use conditionals to create running total and limit number input.
This is the solution for lesson 2.2, running total and limit number assignments.
Create a program where a user can chose a character, assign magic and pick a traveling companion. The character's power is determined by which character is chosen, if magic is selected, and which traveling companion is picked.
Solution code for conditionals practice assignment, Lesson 2.2.1
This video introduces the if - elif - else conditionals. This will allow the code consider additional conditions. Examples are in the next lesson.
Here's a coding assignment using the if - elif - else conditional that asks a user to guess your secret number and tells them if their guess is too high, too low or just right!
This video introduces Boolean values, basically a True or False value. We will also look at logical operators (and, or, not).
Here are some examples of Boolean values and operators in use.
Using nested if statements
Solution code for nested conditionals, Lesson 2.6
In this assignment, you will create a weather checker to help you decide if you should go outside. You will use nested conditionals containing if's, elif's and else's to check multiple conditions.
Solution code and video for using nested conditionals, if, elif, else, Lesson 2.7
This is the section 2 quiz and covers the material from lesson 2.1 through lesson 2.7. Feel free to use any code you have from these lessons as well as the Internet as a resource. Good luck
Introduction to while loops. A while loop let us repeated run certain lines of code without having to rewrite those lines of code multiple times.
Solution code and video for while loops, Lesson 2.8
This demo shows how to break out of a while loop before the loop ends. We use the 'break' command to end a loop. See the demo video for details!
Solution code and video for breaking a loop
Work through the 3 short coding assignments that use while loops. These assignments are simple games I think you'll like coding and playing.
Solution code and video for using loops assignment, Lesson 2.10
This is a continuation of the using loops assignment from Lesson 2.10
Solution code and video for using loops, Lesson 2.10.1
Using loops assignment - continued, Lesson 2.10.2
Solution for using loops assignment, Lesson 2.10.2
This video introduces the concept of libraries that can be imported into Python and looks at the randint() function specifically.
Solution code and video for using the random library and the randint() function.
See the video for an instructor-led example on importing the ranndom library and using the randint() function. In this short code exercise, we create a coin toss game.
Solution for import random library and using random.randint() for Lesson 2.12, coin toss game.
You will create a random ice-cream choosing program using the random library and the randint() function.
Solution code and video for variable assignment using random.randint(), Lesson 2.13
This is the Unit 2 exam. You may feel free to use ALL resources from previous lessons as well as any Internet resources.
Here is an optional final project to explore. It's an online restaurant menu where a user can order various menu items and the program keeps track of the costs and calculates the total. See the details in the document included in the "Documents" tab above.