CSET-105 Week 2

Building Blocks of a Program

Agenda

Practice Problems

Write the algorithms first and see if you can find the solution on paper. Then go the code sandbox in the book, convert your algorithm to comments, fill them out with code, then test it!

  1. Ask for the user's first and last names, then print a greeting with their full name.
  2. Ask for the user's age, then print out a message saying whether they are old enough to vote.
  3. Come up with a password. Ask the user for the password and tell them if they guessed it correctly.
  4. Print out all the numbers from 1 through 10.
  5. Print out all the even numbers from 1 through 10.
  6. You want to take your friends to the movies, but your car can only carry 4 people. Ask the user how many people are coming and print out the number of trips it will take.
  7. Pick a number between 0 and 10. Ask the user to guess the number and print out a success message if they get it correctly. After they guess 3 times, print a message saying they lost the guessing game.