JumpStart Live (JSL)
- Review your Election time solution and be prepared to talk with others about your code
- Review the Iterator notes from JumpStart
- Watch Day 3 Videos (~33 minutes)
- Review lesson notes for Day 3
- Complete the exercises and be prepared to discuss them with others in class
- Understand and be able to use iterators and loops
- Share what you learned from our last session about conditionals
- Walk your partner though your Election time code focusing on using programming vocabulary (e.g, blocks, loops, iterator, variable assignment, conditional statement)
-
Write a program that allows a user to play a guessing number game. Your program should generate a random number between 0 – 1000 (including 0, but not including 1000). Allow the user to make a guess until they guess the answer. After each guess you should print "higher" or "lower". When they guess it correctly print a winning message along with their total number of guesses.
Guess my number: 10 HIGHER Guess my number: 200 LOWER Guess my number: 150 HIGHER Guess my number: 160 HIGHER Guess my number: 161 YOU GOT IT IN 5 GUESSES!
-
Write a program that plays duck duck goose. Allow the user to enter the player's number they want to call goose on, and then say "duck" for each player before the "goose", then say "goose" for the chosen player.
Which player do you want to Goose? 5 Player 1: Duck Player 2: Duck Player 3: Duck Player 4: Duck Player 5: Goose
-
Write a program that allows a user to enter the number of petals on a flower. Then one by one, print “plucking petal #1: they love me!”. Alternate “They love me” and “They love me not” as well as increase the petal number for each petal.
-
You don't trust your users. Modify the program below to require the user to enter the same value twice in order to add that value to the total.
puts "Hello! We are going to total some numbers!" puts "Enter a negative number to quit." total = 0 input = gets.chomp.to_i while input > -1 total += input input = gets.chomp.to_i end puts "Result: #{total}"
Hello! We are going to total some numbers! Enter a negative number to quit. 3 3 2 2 -1 -1 Result: 5
- What different types of loops and iterators did we learn about today?
- What topics are you still struggling with?
- What did you especially enjoy about today's class?
- What can be improved for future classes?
- Day 3 Videos
- Iterator notes from JumpStart
- Revise your code for exercises for the day based on discussions in class, then share the gist with the instructors
- Review the Iterator notes from JumpStart
- Watch Day 4 Videos (~8 minutes)
- Review lesson notes for Day 4
- Complete the Day 4 exercise and be prepared to discuss it with others in class