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.
Activity 8
Change the restaurant program (repeated below) so that it asks the user for the number of people.
Next, in Section 6, you’ll learn a different form of iteration.
OpenLearn - Simple coding
Except for third party materials and otherwise, this content is made available under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 Licence, full copyright detail can be found in the acknowledgements section. Please see full copyright statement for details.
