Question
USING THE PYTHON LANGUAGE 1. a) Exercise 1 In mathematics, the factorial of a non-negative integer n, denoted by n!, is the product of all
USING THE PYTHON LANGUAGE
1. a)
Exercise 1 In mathematics, the factorial of a non-negative integer n, denoted by n!, is the product of all positive integers less than or equal to n. For example, 5! = 5 * 4 * 3 * 2 * 1. For this exercise, create a function called factorial that takes a single integer parameter n and returns n!. Write this function using a while loop. Have your program prompt the user for an integer, call your function and then print the result to the terminal.
b)
Modify the function you wrote in the previous exercise to accomplish the same goal using a for loop.
c)
Write a function that will cycle through a string and count the number of vowels contained in the string (feel free to reuse or modify any code you may have laying around to accomplish this task). Finish this exercise by prompting the user for a string, call your function passing the input string and reporting the number of vowels to the user.
d)
write a program that will continually ask the user to enter integers until they enter one that is divisible by 1, 2, 3, 4 and 5
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started