Search for question
Question

CSEN 2304 Introduction to Computer Science Spring 2024 Assignment 2 This assignment consists of six individual sub-assignments that provide practical experience with the concepts and language constructs that have been covered to date. To complete the assignment you will need to write six separate Python programs that perform the tasks specified in the problem descriptions below. Make sure to include appropriate comments in your source code to document your program. Those comments should include headings at the start of your code with your name, K-number, and the date submitted. Also remember to follow the standard Python coding conventions discussed in class. Turn in your solutions by submitting a zip file that contains your three Python programs via the corresponding Blackboard system link for the assignment. 1. Write a Python program that will prompt the user appropriately and accept a positive integer value as input. The program should then calculate and print the factorial (!) of the number along with an appropriate descriptive output message. For example, if the user input the value "5", the program should print its factorial value of "120", along with a descriptive message for the output, since 5*4*3*2* 1 = 120. 2. Write a Python program that will prompt the user appropriately and then accept a positive integer value as input. The program should then calculate and print the number of digits in the number along with a descriptive output message. For example, if the user inputs the value "5872", the program should answer "4" since "5872" has 4 digits. If instead the user inputs the value "99", the program should answer "2" since "99" has 2 digits. 3. Write a Python program that will prompt the user appropriately and accept an input value for the start of an integer range. It should then prompt the user and accept an input value for the end of a range. Next the program should calculate and print the cube of each value within the range (inclusive). For example, if the user entered "5" for the start of the range and "7" for the end of the range, the program should generate the following output: The value of 5 cubed is: 125 The value of 6 cubed is: 216 The value of 7 cubed is: 343 4. Write a Python program that will prompt the user appropriately and accept a positive integer value "n" as input. The program should then print the first "n" powers of 2. For example, if the user inputs the value "8", the program should generate the following output: 2 raised to the power of 1 is: 2 2 raised to the power of 2 is: 4 2 raised to the power of 3 is: 8 2 raised to the power of 4 is: 16 2 raised to the power of 5 is: 32 2 raised to the power of 6 is: 64 2 raised to the power of 7 is: 128 2 raised to the power of 8 is: 256 5. Write a Python program that will prompt the user appropriately and accept an input value for the start of a range. It should then prompt the user and accept an input value for the end of a range. The program should then find and print the prime numbers within the integer range along with a descriptive message. Recall that a prime number is a whole number greater than 1 that cannot be evenly divided by any whole number other than itself and 1. So, for example, if the user entered "2" for the start of the range and "12" for the end of the range, the program should generate the following output: The prime numbers between 2 and 12 are: 2 11 3573 6. Write a Python program that uses looping structures to print the following output pattern. 12 123 1234 12345 123456 1234567 12345678 123456789