Python


Python is probably the most popular language for learning, and I am learning to use it for my new computer science electives for grades 7 and 8.
Python is a text based language without the fussy semicolons and curly braces and variable declarations that can be so difficult to use for younger middle school students. Since Python is also widely used in industry, students are happy to be learning a 'real programming language' as they call it, and there are TONS of resources available online.

Many of the resources are for version 2.7 etc, and I am using version 3.5.. However here are few that I have found useful so far:

What do I actually use in my Python classroom and Why?
I use IDLE and Python 3 in the computer labs at my schools. This is an offline editor and programming environment. This means students have to create files using the naming conventions I give them, make folders, back up files and submit their solutions to me on the school server (I use a simple script to grade them as a batch). In addition to teaching them some file management skills, they are also not distracted by other things online or trying to find solutions online. They tend to stay on task on the offline environment, often not opening the browser for the entire class.

Python Code-Along
I teach Python by doing a 'Code-along' to build a small project that will use a new concept. Students code along with me, and participate by contributing/ suggesting / guessing what to add to the project. At the end, each student has a working project. 

Python Coding Challenge Sets
Each new concept Code-Along session is followed by students working on a set of coding challenges. These are a set of 5-10 projects that are leveled tasks that provide them with plenty of choice, and opportunities to be creative and extend projects as needed. 

Sample Coding Challenge Set  - input, output, variables, data types
  1. Rectangle calculator - ask user for width, and height,  Print total area, and perimeter.  Do not worry about units 
  2. Mad Lib : ask user for different items and print a mad lib
  3. When will you be 21? - ask user for name, and age and tell them the year they will be 21. Assume user enters a number below 21.
  4. Weight on the moon : Ask user for weight in pounds and give weight on the moon.
  5. Candy calculator : Ask user for number of boxes of M&M and number of bars of Hersheys chocolate,  and then print total cost of candy. You can use any known amount for the price of each box of candy.
  6. Calculate tip on the restaurant bill. Ask the user for the amount of the bill and then print out the tip amount for 15% and 20% .
  7.  Ask user for 2 numbers and then print out as many operations as possible between first and second number. Example user enters 5 and then 2. Print out the following… 
Sample Coding Challenge Set  - lists, for loops
    1. Magic 8 Ball: Write a program that gives a random response to any question. You will need a list of responses, input, print, and modules random and time/sleep so it looks like program is thinking
    2. Write a program that gives a different story each time it is run. Use lists for phrases, names, places, adjectives and more to create a story that is generated using random values from the list.
    3. Write a program that gives different versions of the following Limerick each time it is run. Some more about limericks at http://www.poetry4kids.com/lessons/how-to-write-a-limerick/
    4. Write a program that asks user to enter a food item until they press the word ‘exit’. It then prints the list sorted, formatted and without duplicates.
    5. Use the following list in your code.Breakfast = [ 'toast', 'eggs', 'oatmeal', 'cereal' ]
      Print the food choices as a nicely formatted menu, with one food item per line with a random price between $1 and $10
    (Hint: Use a for loop to print menu. Use the random module to get the prices
    Make it look nice if you want an extra challenge.
    Yes- you can change the list to different foods ! )
    (Optional challenge)  Ask the user for a food to replace in the above Breakfast list, and what to replace it by, and then change it and print the new list

        6. Given a list of student names ( use from our class or make up the names) as a list , exampleStudents = [ ‘john’, ‘susan’  ]
            Use for loop and
    1)Print list of names one per line.
    2) Find the number of students  name begins with ‘a’ and print the total
    3) find the % of students name begins with ‘a'
    4) find average length of name

         7. Write a program that takes a list of high scores separated by , as input, and then prints the lowest score, and the highest score. Extra : print the average of the numbers.
    HINT: Use the following to take information and split it based on the ,
    userInput = input(‘Enter high scores’)
    scoresList = userinput.split(‘,’)