JULIE: PRIVATE SESSION - PYTHON CODING

This page is the one-stop resource for everything we do in class!
You will be able to find links to slide content, kahoot quizzes and more resources below

Python - For Loop Coding.PNG
Python differene between = and ==.PNG

HOMEWORK ASSIGNMENT 3

Create a program that counts the number of words that have 3+ letters using the following data:

Sentence = “Julie loves cute little animals and is super great at coding”

Remember, you’ve already solved a part of the problem!
Do refer to older code you have worked on too!

Your approach should:
Focus on separating out the words from Sentence:

- How do I, as a human, recognize a word?

Ask yourself: Can the computer use the same method?

- You can make use of an array
- You will need a for loop
- You may need counter(s) and variable(s)
- You will need decision making
- You can use string concatenation:

"j" + "u" + "l" + "i" + "e" becomes "julie"

Understand that this is not a particularly EASY problem, but it will test your understanding of coding concepts so far!

HINT:
Separate out the problem into a smaller subset
Using the Sentence = “Julie loves cute little animals and is super great at coding”
Print out the following first:
J
u
l
i
e
THIS IS A SPACE, EVERY LETTER BEFORE ME MAKES A SINGLE WORD
l
o
v
e
s
THIS IS A SPACE, EVERY LETTER BEFORE ME MAKES A SINGLE WORD
c
u
t
e
THIS IS A SPACE, EVERY LETTER BEFORE ME MAKES A SINGLE WORD
and so on and so forth

Homework Assignment 2

Create a program that calculates a class average.
(Do scroll down to the downloads section to download the file from lesson 2)


There are 10 students in the class and their scores are as follows:

  • 40

  • 50

  • 5

  • 99

  • 55

  • 20

  • 96

  • 39

  • 49

  • 100

In order to calculate the class average you would use the math equation below:

Sum of all scores in class
Class Average = —————————————
Number of Students

This is the final result using the calculation above:

Sum of all scores in class = 553
Class Average = 553 / 10 = 55.3

Use your knowledge from the following code structures to solve this problem:

  • Variables and how to store a value

  • For loops in order to repeat a code block

  • Arrays and indexes, how to create a list of items

  • Print statements to display your final result

Remember you are CODE STITCHING, so before you start coding right away:

Write multiple line comments which will act as pseudo code and list out the steps you would take to solve this in english FIRST.
Use pen and paper too, and refer to code we worked on in class as well for ideas!

If your pseudo code is accurate - translating from english to code becomes much easier because your understanding of the logic is
already fully thought out :)

homeWORK ASSIGNMENT 1

Write a program that mimics a chatbot!
(Do scroll down and check out the file downloads section)

Your program should make use of decision making through if-elif and else conditions.
To make the program seem more “intelligent”, remember that you can nest decision checks (if-elif condition branching)
within other decision checks.

Your program should continue back and forth with the player (user) for a minimum of 8 questions.

For eg:

What is your name?
amina
Hey Amina! It’s great to meet you!
What is your fav color?
red
Well that’s a bright color! What’s your fav food to eat, all the time?
fries
Omg yes, all things potato forever!
Etc etc

In the example above, the conversation maintained itself back and forth for 3 questions.
Feel free to have fun with this assignment, and make it yours!

If you encounter errors, try your best to fix them, they’ll most likely be one of the following:

  1. Spelling Mistakes / Incorrect Keywords

  2. Missing Symbols

  3. Weird Indents

  4. Sometimes the bug is on the previous line rather than where the red highlight is happening

Slide Links

Will add links here as we continue

OTHER USEFUL LINKS

Will add links here as we continue

Share Code Easily (Pre-Formatted)

KAHOOT LINKS

You can ‘preview’ a Kahoot to play it and it will open up the
teachers view and the mobile view on your screen. Just don’t cheat! :D

Will add kahoot links here as we continue

FILE Downloads

Need files we worked on in class? Check out this section!
Note:

  • If the file link is broken or the files are a link to an older version, get in touch with your teacher at amina@thecubeschool.ca:

  • Keep in mind that these are teachers copies of the files and as such are not the customized versions of your work

Julie - Intro (Use this file as reference when creating your chatbot)
Intro to Modules and For loops (Use as reference when working on h/w assignment 2)

CODING @ HOME INSTALLATION INSTRUCTIONS

Python Editor Idle ( Download for either Mac OS or Windows OS here )

HOW TO CREATE A FILE

  • Open up Idle

  • Click File -> New File at the top of the shell

  • Save with cntrl + s (windows) or cmd + s(mac)

HOW TO EDIT / VIEW FILES

  • When editing an existing python file, right click to ‘Edit with Idle’

HOW TO RUN FILES

  • Press F5(windows) or FN + F5 (Mac) on your keyboard

  • To setup function keys (F1, F2, F3 etc.) on your Mac with FN key:

    • Choose System Preferences from the Apple menu

    • Click Keyboard

    • Click the Keyboard tab if it's not already highlighted

    • Select "Use all F1, F2, etc. keys as standard function keys”

coding jokes

Because we all need a bit of clever-funny in our lives