-
Notifications
You must be signed in to change notification settings - Fork 243
Batman
LeWiz24 edited this page Aug 27, 2024
·
2 revisions
TIP102 Unit 1 Session 1 Standard (Click for link to problem statements)
- 💡 Difficulty: Easy
- ⏰ Time to complete: 5 mins
- 🛠️ Topics: Functions, Print Statements
Understand what the interviewer is asking for by using test cases and questions about the problem.
-
Q: What should the function return?
- A: The function should not return anything; it should only print a specific string.
-
Q: What exact string should be printed?
- A: The function should print
"I am vengeance. I am the night. I am Batman!"
.
- A: The function should print
-
The function
batman()
should print a specific string when called.
HAPPY CASE
When the function batman() is called, it should output:
I am vengeance. I am the night. I am Batman!
EDGE CASE
In the case of the batman() function, there aren’t any traditional edge cases to consider, as the function simply prints a fixed string without any inputs or conditions that could vary the output.
Plan the solution with appropriate visualizations and pseudocode.
General Idea: Define a function that prints the desired string.
1. Define the function `batman()`.
2. Use the `print` function to output the string.
- Forgetting to include parentheses in the print function.
- Not using the correct quotation marks for the string.
Implement the code to solve the algorithm.
def batman():
print("I am vengeance. I am the night. I am Batman!")