1.14. Chapter Assessment¶
Check your understanding
- Because computers are better at solving problems.
- Computers aren't necessarily better at solving problems, though often they can be quicker than humans. Additionally, algorithms can be used to solve non-computer related problems.
- So that you don't have to solve the problem yourself.
- While it is beneficial to have a set of instructions that others can follow, this isn't the best answer. By creating the algorithm, you solve a problem for yourself and others.
- So that you have a general solution to a problem.
- Yes, by creating a general solution you can then express it as a program if you choose, and then use a computer to automate the execution.
- Because you need a set of instructions to follow.
- While it is beneficial to have a set of instructions as that is what an algorithm **is**, it is not **why** we would want to create one.
Why create an algorithm?
Write code to print out the phrase “Hello World”.
- nothing, there is an error
- There is no error in this program.
- Catch you later!
- Catch you later! is a comment, as indicated by the # sign, so it won't be printed
- Good-bye! Hope you are well. Hello!
- Yes, the lines are printed in the order the Python interpreter gets to them, top to bottom.
- Hello! Hope you are well. Good-bye!
- While it might make sense to say hello before good-bye, the Python interpreter just follows instructions in order as given
- Hello! Hope you are well. Good-bye! Catch you later!
- No, that is not the order in which Python sees the instructions.
What will be output to the console when the following program is run?
# print("Catch you later!")
print("Good-bye!")
print("Hope you are well.")
print("Hello!")
You have attempted of activities on this page