Skip to content

Latest commit

 

History

History
17 lines (12 loc) · 700 Bytes

exercise.md

File metadata and controls

17 lines (12 loc) · 700 Bytes

Loops 101

Objectives

  1. Write a loop to ask the name and age from a user and print "Your name is ___ and your age is ___ years old"
    1. This should be infinite loop
  2. Define the following array "pizza"}
    1. Append to it the following item: "hamburger"
    2. Append to it the following item: "salad"
    3. Iterate over the list and print for each item Food: <Food name>. Make sure to replace <Food name> with item from the array
  3. Define the following fixed array of 3 items: {square, circle, triangle}
    1. Iterate over it and print for each item the following: This is <ITEM> and its index in the array is <INDEX>

Solution

Click here to view the solution