Coding Quiz
The first coding quiz is to write a function that outputs five times the given number.
It is a simple program that takes a single integer input from the user, calculates five times that integer, and outputs the result.
Coding quizzes require you to write only the function that meets the given conditions, rather than the whole code.
As explained in the introduction, you only need to implement the input and output of the function defined as def solution. π
def solution(number): return # Write your code here
Hints
-
defis the keyword for defining a function, which is a block of code that performs a specific task. -
returnis the keyword used to return the result of a function. The value that followsreturnis given as the result of the function. -
To return five times the given number (number), you need to write number multiplied by 5 after return. In Python, multiplication is performed using the
*operator.
Based on what you've learned so far, write a function that outputs five times the input number and check if it passes the test.
You can also view an example answer by clicking the Example Solution button at the bottom right.
Input and Output Example
-
Input:
16 -
Output:
80
-
Input:
3 -
Output:
15
Lessons in this chapter Β· Mastering the Basics
- 1. What is Programming?
- 2. What is Python and Why is it Popular?
- 3. Containers for Data, Variables
- 4. Data Types in Python
- 5. Operators for Performing Operations on Variables and Values
- 6. Fill-in-the-blank quiz
- 7. How to Talk to a Computer (Input and Output)
- 8. Various Ways to Output Values with the print Function
- 9. Escaping Special Characters
- 10. Converting Between Strings and Numbers
- 11. Reserved Words with Special Meaning, Keywords
- 12. What is Indentation and Why is it Important?
- 13. Multiple-choice quiz
- 14. Coding Quiz - Return Five Times the Given Number
Lecture
AI Tutor
Design
Upload
Notes
Favorites
Help