Write the answers of the following questions in the available space.
Define a function called cube that return a cube of a number.
Write the appropriate docstring as well.
Write print(cube(3)) and print(cube(5)) and make sure the answer is correct.
Define a function called count_down that accepts 1 arguments. When you call count_down(3) , the output should be like this: 3... 2... 1... 0!. Use for loop inside your function so that you get the desired output.
Write the appropriate docstring as well.
Write count_down(4) and make sure the answer is correct.
Define a function called count_down_skip that accepts 2 arguments. This function is similar to count_down but it skips the number in the second argument. Ex: count_down_skip(5, 2) would be 5... 4... 3... 1... 0!
In addition to for loop, use if statement inside your function so that you get the desired output.
Write the appropriate docstring as well.
Make the default value of the second argument is 0.
Write count_down(6,3) and make sure the answer is correct.
Make a new file called counting.py
Copy the function count_down and count_down_skip into it.
Then, in main.py, using the import syntax, give alias to count_down_skip to be cds.
Write cds(5, 1) and make sure the answer is correct.
Extend the code so that it can skip several numbers. If I call cds(10, 1, 4, 3), it should skip number 1, 3 and 4.
Make a new class called Count. This class accept two arguments: the person name who is counting, and the starting number for counting. Then write, player1 = Count('Anna', 5) player2 = Count('Barry', 8)
Using what you did in no.2, make a function called start_count in that class so that when you write player1.start_count() it will give the following output: Anna is starting to count from 5. Start! 5... 4... 3... 2... 1... 0!
Write player2.start_count() after that and make sure that the answer is correct.
Make a while Loop that ask for names, numbers, and numbers to skip. (The italic part is the input.) It should be like follows: Enter your name: Alex Input your starting number: 5 What number do you want to skip: 3 Do you have more number to skip (Y/N): Yes Please only input Y or N. Do you have more number to skip (Y/N): Y What number do you want to skip: 1 Do you have more number to skip (Y/N): N Alex is starting to count from 5. Start! 5... 4... 2... 0!