Search the courses, subjects, tracks, games and features, or jump straight to a page.
4 cards from this section. Quick, good the night before a test.
What is a module in Python?
Think about how you would organize functions.
How do you import a module in Python?
What do you type to bring the math functionalities into your program?
What is the primary purpose of modules in Python?
Think about why we don't want to write the same code multiple times.
True or False: The random module is used to perform mathematical operations.
What kind of tasks do you think random numbers are useful for?
Create a Python file named 'my_custom_functions.py' that includes a function to calculate the factorial of a number. Import this module into your main program and use it to find the factorial of a number provided by the user.
Factorial of n is n * factorial(n-1) until n is 0.
Design a module called 'string_operations' that has functions for counting vowels and reversing a string. Import this module and demonstrate both functions in action with user-input.
Use a loop for counting vowels and slicing for string reversal.
6 more questions in this section. Enroll free to practise them all.
Enroll free