I Hate CBT's

View Original

7.1.5: Initials

Question: What is wrong with program KeyboardInput01.py? (input())

Answer: The program doesn’t use input properly because they don’t give the user a prompt

Question: Can you assume that the user will have knowledge of the inner workings of your program?

Answer: no

Question: What is the purpose of using a prompt with input?

Answer: It instructs the user to enter something; the prompt is a string literal parameter of the input command

Question: Can one program input multiple values?

Answer: yes

Question: Look at program KeyboardInput04.py. Why does this program not add the 2 numbers properly? (5

  • 4 = 54)

  • Answer: The program performed concatenation instead of addition because the program tried to add strings