Skip to content
Skip to main content

About this free course

Author

Download this course

Share this free course

Simple coding
Simple coding

Start this free course now. Just create an account and sign in. Enrol and complete the course for a free statement of participation or digital badge if available.

5.2 A conversion function

The solution is to use the built-in function int that takes a string and converts it to an integer, which is a number like –2, –1, 0, 1, 2, etc. If the string represents a decimal number, int will give an error.

Interactive feature not available in single page view (see it in standard view).

Activity 8

Change the restaurant program (repeated below) so that it asks the user for the number of people.

Interactive feature not available in single page view (see it in standard view).

Next, in Section 6, you’ll learn a different form of iteration.