2nd Semester Intro to Computer Science

What you will learn

Project

Using Python, students will use variables, input, and printing to create a Mad Lib. You will also practice designing a project by planning out your Mad Lib before implementing it. Part of the project is to use your creativity to design your own unique story.

Overview

Mad Libs are a fun way to tell a story. The story is pre-written except for a few missing words. The story is hidden from the user. The user is asked a series of questions in order to fill in the missing words before seeing the story. Then the story is read off with the user’s words mixed in!

Details

Behavior

Implementation Details

Plan out your story on pencil and paper first, before you start implementing the program.

  1. Create your story
  2. Select the missing words
  3. Determine each words part of speech
  4. Create introduction
  5. Create questions
  6. Divide story into print statements

As mentioned above the program must request words from the user. The following must be included in the program:

Alternate Project

Created by Brian Weinfeld

Using Python, you will use variables, input, and casting to create a Magic Square.

Overview

Pick a number from 21-65. 42, you say? OK! Check this out!

22 01 12 07
11 08 21 02
05 10 03 24
04 23 06 09

If you add up all the numbers in each row, they total 42. (22 + 1 + 12 + 7 = 11 + 8 + 21 + 2 = 42)

If you add up all the numbers in each column, they total 42. (22 + 11 + 5 + 4 = 1 + 8 + 10 + 23 = 42)

If you add up all the numbers in each diagonal, they total 42. (22 + 8 + 3 + 9 = 7 + 21 + 10 + 4 = 42)

It is the same for each of the four corners, and each 2x2 block as well. (22 + 4 + 9 + 7 = 42)

This is called a Magic Square and for this project, you are going to create a program that lets users select a number and create a magic square from that number.

Details

Behavior

  Welcome to Magic Square
  Enter a number from 21 to 65: 42
  You have entered 42

  Here is your Magic Square:

  22 01 12 07
  11 08 21 02
  05 10 03 24
  04 23 06 09

Implementation Details

Believe it or not, Magic Squares are not difficult to make! Watch the following video to see how to make a Magic Square for any given number:

Magic 8 Ball

Challenge

This section contains additional components you can add to the project. These should only be attempted after the project has been completed.

Rubric

Student Name: ___________ Date: ______

Students can correctly use the IDE (1.01)

3 2 1 0 Points
Students have correctly used the IDE - - No evidence that the student can use the IDE  
      Sub Total  

Student can correctly identify and store variable types (1.02, 1.04)

3 2 1 0 Points
Student correctly stores variable types - Student sometimes stores the correct variable type No evidence that the student can store correct variable types  
Student program asks for input and stores it as a variable - Student program asks for input, but does not store it No evidence that the students can use the input function  
      Sub Total  

Student can use the print function (1.03)

3 2 1 0 Points
- Students have correctly used the print function - No evidence that the students can use the print function  
      Sub Total  

Student can decompose a problem to create a program from a brief

3 2 1 0 Points
Student program runs without error The students program has a few errors, but it does not impact the program’s functionality Student program has errors that impact the program’s functionality Student program is not functional  
- Students submitted documentation showing planning for most variables and functions. Students submitted documentation showing planning for a few variables and functions. No evidence of planning  
      Sub Total  

Student uses naming/ syntax conventions and comments to increase readability

3 2 1 0 Points
- Syntax conventions are generally used Sometimes syntax conventions are used No evidence of syntax conventions to aid in code readability  
- All variables have clear names Some variables have clear names No evidence of using variable names to aid in code read ability  
- Student comments aid code readability No evidence of using comments to aid in code readability.    
    Sub Total    

Final Grade

     
__ 21 ___ ____ X ____ ____
Points Possible Points Earned x Weight total Points

Check your understanding

Pick an answer for each question. You can try again until you get it right.

1. Why does a Mad Libs program store each answer in its own variable?

  • Because input can only be used once
  • Because Python forbids printing text directly
  • Because variables make the program run faster
  • So the words can be reused later when the story is printed

Storing each answer in a variable lets the program combine all the words into the story after collecting them.

2. Which variable name best helps a reader understand the program?

  • x
  • adjective1
  • thing
  • a1

A descriptive name tells the reader what the variable holds, which makes code easier to read.

3. Why plan a project on paper before coding it?

  • Breaking the problem into steps first makes it easier to write and debug
  • Python will not run unplanned programs
  • Planning replaces testing
  • It makes the program print faster

Decomposing a problem into steps before coding gives you a clear path to implement.

Downloads