1. Learn
  2. /
  3. Courses
  4. /
  5. Introduction to Python for Developers

Connected

Exercise

Using a while loop

You're building the recipe scaler and need to count how many guests have confirmed attendance for your pasta party. You've received RSVPs and want to process them one by one using a while loop. You have a variable total_confirmations representing the number of RSVPs received, and you need to count through them to determine the final guest count. This will help you know how much to scale the tomato and basil pasta recipe.

Note that if your while loop takes too long to run, or your session is expiring, you might have created an infinite loop. In particular, remember to indent the contents of the loop using four spaces or auto-indentation, and make sure the conditions are such that the loop has a stopping point.

Instructions

100 XP
  • Write a while loop that continues as long as guest_count is less than total_confirmations.
  • Inside the while loop, increment guest_count by 1 each time to count another confirmation.