Getting Started with Programming

Your First Project: An Interactive Greeter


This chapter is the first project checkpoint of the course. From this part onward, every part ends with a checkpoint that grows the same long-running project. The study log you start here will be with you until Part 8.

In this checkpoint, you write the first working version of the study log: a small interactive program that introduces itself, asks the user a couple of questions about a study session, and prints a friendly, personalized response.

What the First Version Should Do

Your first version of the study log should:

  1. Introduce itself with at least one print statement.
  2. Ask the user for at least two pieces of information using input(...), one of which is a number of minutes.
  3. Use a variable to store each of those inputs.
  4. Convert the minutes input to a number and compute one derived value, such as hours.
  5. Print a final response that combines the inputs into one personalized summary.

That is enough for this part. The features you might expect from a full study log — saving sessions between runs, looping over many sessions, summarizing them — all arrive in later parts. For now, your goal is to put together everything you have learned this part into one small program of your own.

A Worked First Version

To make the target concrete, here is what one possible first version could look like. Your own version does not have to match this exactly. It is one example of one shape it could take.

print("=== Study Log ===")
print()
name = input("What is your name? ").strip()
subject = input("What did you study today? ").strip()
minutes_text = input("For how many minutes? ").strip()
minutes = int(minutes_text)
hours = minutes / 60
print()
print(f"Got it, {name}.")
print(f"Today you studied {subject} for {minutes} minutes.")
print(f"That is about {hours:.1f} hours.")
print("Keep going!")

When you run this program and type Ada, Linear algebra, and 90 in turn, the output looks something like:

=== Study Log ===
What is your name? Ada
What did you study today? Linear algebra
For how many minutes? 90
Got it, Ada.
Today you studied Linear algebra for 90 minutes.
That is about 1.5 hours.
Keep going!

Several things from this part show up here:

  • print(...) and input(...) from Print and Input.
  • Variables holding the user’s answers from Variables.
  • .strip() to clean up extra whitespace from Working with Strings.
  • int(...) to convert text into a number and division to compute hours from Numbers and Arithmetic.
  • An f-string with a format specifier (:.1f) to control how the float is shown.

Read the example line by line and trace it with the input Ada, Linear algebra, 90. If you can predict what each line does without running the program, you have already met the goals of this part.

Your Turn

Now build your own first version. The requirements again, in one place:

  1. At least one introductory print line.
  2. At least two input(...) calls, one of which collects a number of minutes.
  3. At least two variables holding the user’s answers.
  4. A conversion from minutes (text) to minutes (number), and at least one derived value such as hours.
  5. A final, personalized summary that uses the inputs.

Beyond that, you have freedom. You can use any field names that make sense to you, ask different questions than the worked example, and format the output however you like. A few possible directions:

  • Ask for the date of the session as well, and include it in the summary.
  • Ask the user to rate the session (an integer between 1 and 5) and echo it back in the summary.
  • Show the session length both in minutes and in hours, or in hours and minutes (“1h 30min”).

These are suggestions, not requirements. The most important thing is that you wrote and ran the program yourself.

A few small habits worth picking up here:

  • Use f-strings rather than long + chains. They tend to read better.
  • Use .strip() on user input, since users often type extra spaces without noticing.
  • If a line is hard to read, split it.

Interactive study log greeter

0 / 30 points

Build the first interactive greeter version of your study log.

Your program must:

  • introduce itself with at least one print(...),
  • ask for the learner’s name with input(...),
  • ask for the study subject or topic with input(...),
  • ask for study minutes with input(...),
  • store each answer in a variable,
  • convert the minutes to a number,
  • compute hours as minutes / 60,
  • and print a personalized summary.

The summary must include the learner name, the subject or topic, the original minutes, and the computed hours. Show the hours with one decimal place.

Example input:

Ada
Linear algebra
90

One possible output:

Study session recorder
Session saved for Ada.
You practiced Linear algebra for 90 minutes.
That is 1.5 hours of focused work.

Common Pitfalls

A few things that often trip students up on this first project:

  • Forgetting that input(...) returns text, and then trying to do arithmetic on it without converting first.
  • Using + to combine a string and a number, which raises a TypeError. Use an f-string instead.
  • Choosing variable names that look slightly different in two places (min vs mins, name vs Name).
  • Writing one long line that does too many things at once. If a line is hard to read, split it.

If you hit one of these, the right response is the cycle from this part: trace what is happening, add a debug print if needed, fix the one specific issue, and run again.