Monthly Archives: November 2018

Mad Libs 1 [Python]

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

mad_libs_screen_shot

Implementation Details

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

  • Create your story
  • 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. noun1verb2, 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

 

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

alice-math_1

What if we want to multiply 2  by  0.5 ?

 

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

alice-math_2

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

alice-math_2

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

alice-math_3B

4) The calculator appears so you can  choose 5

 

5)  Select “5”

alice-math-calculator

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

alice-math-4

 

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

alice-math-5

9) Select the down arrow

alice-math-6

10) select as shown:

alice-math-7

 

11) Viola :

alice-math-8

 

 

 

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

Diagram 1

 

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

 

what-as-a-number-optiimized