One of the most common control structures you'll use, and run into in other programs, is the if...else conditional block. Simply put, the program asks a yes or no question; depending on the answer, different things happen.
If you've programmed in other languages, the if...else statement works the same way. The key difference is that, in Python, the elseif statement is written as elif for checking multiple conditions, as shown in following screenshot:
In the preceding example, the preference() function is used to hold the main code logic; functions are explained in Chapter 4, Functions and Object Oriented Programming, in the Working with functions section. The input() function prints the string within parentheses to the user (normally a question), and accepts the user's input, and that input is assigned to the answer...