Monthly Archives: November 2018

Taken from https://teals-introcs.gitbooks.io/2nd-semester-introduction-to-computer-science-pri/units/1_unit/06_lesson/project.html

Overview: 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.

The program will print out the title of the Mad Libs story, as well as a short explanation of game play

The program should then prompt the user to enter in nouns, verbs, adjectives, proper nouns, and adverbs

Implementation Details

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

• Select the missing words
• Determine each words part of speech
• Create introduction
• Create questions
• Divide story into print statements

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

• 10 different words inputted
• Variable names should correspond to the part of speech requested and part of the story they belong to (e.g. `noun1``verb2`, etc)
• You may only use 3 print statements to tell your story

Scheme/Rubric

Functional Correctness(Behavior)
Program greets user and explains rules 3
Program accurately requests 10 words (1 for word, 1 for correct request) 20
Program prints full Mad Lib 10
Program exhibits creativity 3
Sub total 35
Technical Correctness
Program utilizes variable names to convey meaning 5
Correct order of inputted words 10
Only 3 print statements 10
Sub total 25
Total 60

Meaning of “==”

Here’s how you get to “==” in Alice. It’s a world function. (and it must be put into an if test)

Math Expressions in Alice

Alice Supports many types of Math Operations.

For instance, let’s say that we have the variable someNumber  and it has a value of 2

What if we want to multiply 2  by  0.5 ?

1. click on the down arrow next to “2” and select “math”

2) select “2*”  which means “2 times ”

3) Select “Other” for the second number “b”

4) The calculator appears so you can  choose 5

5)  Select “5”

6) Viola: You know have a math expression that represents 2 * 5

8) Now let’s make a variable called “divisor” and then divide this expression by that

9) Select the down arrow

10) select as shown:

11) Viola :

Alice 2 : Asking User for Input

The world object has many, many useful functions including a way to ask the user for information—say  a number, a name or something.

1.  Click on world
2.  click on functions
3. scroll down ot the ask user functions (See Diagram 1 ) and read below for more

Diagram 1

Animated Gif showing the whole process of asking user for a number and then saying that number (using what as a String)

Space Ship Repair Post Mortems

Look at the code below:

Can you see why this student lost credit :

The student did a good job using a function and storing a value in the variable, walkDistance; however, they never then used that variable .

Space Ship Repairs [Post mortems]

Example 1 :

The code below is almost correct , but the variable walkingDistance  is never used by the move method !

Code Diagram 1 :

Code Diagram 2 :