Skip to main content

Exercises 10.9 Drill and Practice

1.

Write code that calculates and prints the first 5 triangular numbers. It should produce the following output:
1       1
2       3
3       6
4       10
5       15
(hint: use a web search to find out what a triangular number is.)

2.

Write a program that initializes a list with a set of predefined elements and then prints each element of the list on a new line.

3.

Write a program that prompts the user to enter a line of text and then prints each character of the text on a new line.

4.

Write a program that repeatedly prompts the user to enter a word and checks whether the word starts with a vowel (a, e, i, o, u). The program should display a message indicating whether the word starts with a vowel or not. The user can exit the program by entering a minus sign ("-").
    Which of the following best describes your experience with these problems?
  • 1.
    I found the problems very confusing and didn’t know where to start.
  • 2.
    I started solving the problems but encountered significant difficulties.
  • 3.
    I managed to solve the problems, but it was very challenging.
  • 4.
    I solved the problems with some minor difficulties.
  • 5.
    I found the problems straightforward and solved them easily.
You have attempted of activities on this page.