You enter 12 for a GAA ticket count. Why does Python show 1212 instead of 24?
Your club needs twelve tickets for each of two groups. You type twelve into a Python program, expecting twenty-four. Instead, the screen shows one two one two. What did Python think you entered?
Read this sequence from top to bottom. Input count means get the number of tickets for one group. Next, multiply the count by two and store the result as total. Finally, output total so the user can see how many tickets both groups need.
Replace input count with this first line. Python displays the prompt Count and waits for you to type twelve. The input function gives you the characters you typed as text. On the next line, times two repeats those characters, and print displays one two one two.
This time, you enter six at the same prompt. The program still goes straight from input to printing raw times two. What appears on the screen? Pick one answer.
The conversion function is called int. The entry from input is a string, which means text, even when it contains only digits. Give int the string containing the digits one and two and it returns the integer twelve. Now you can double the value.
You type twelve at the Count prompt. The first line stores those characters in raw. The second line uses int to store the number twelve in count. The third line doubles that number and sends it to print. The program displays twenty-four.
You run the three-line program again and type fifteen. Input stores the entry in raw. Then int converts it before print uses count times two. What does the print line display? Pick one answer.
With count set to twelve, type count times two on its own in the interactive shell and the shell shows twenty-four. Run that expression on its own in a saved program and the line displays nothing. Print displays twenty-four in either place.
Write a program that prompts for a count and displays twice its value in the format shown. The prompt ends with a colon and a space. Convert the entry, then print the Total label and the doubled count. In the sample run, you type twelve. Check that the output matches exactly.