Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

PLEASE DO NOT COPY PASTE FROM CHEGG/OTHERWISE I'LL REPORT YOU QUESTION:10 Task 2.1 Factorial [5 Points] Background: The factorial of a positive integer n is

PLEASE DO NOT COPY PASTE FROM CHEGG/OTHERWISE I'LL REPORT YOU

image text in transcribed

QUESTION:10 Task 2.1 Factorial [5 Points] Background: The factorial of a positive integer n is the product of all positive integers less than or equal to n. It is denoted as ni. N! = n* (n-1) * (n-2)* (n-3). 3+2+1 Programming task Write a Python program that asks the user for the number and displays the factorial of a user input number. See examples below. How do you deal with a negative number? Example Runs : Enter a number: 6 Factorial of 6 is 720 User input Enter a number: 7 Factorial of 7 is 5040 User input W User input Enter a number:-9 Sorry, factorial for negative number does not exists Task 2.2 A Leap Year [7 Points] Background: A leap year is a year which is exactly divisible by 4 (i.e. remainder is zero) except for the years that are exactly divisible by 100 are also exactly divisible by 400. For instance, 1700, 1800, 1900 are not leap years but 1600, 2000, 2008, 2024, 2032 are leap years. Programming task. Write a Python program to determine whether the provided user input is a Leap year. Example Runs : Enter a year: 1700 1700 is not a leap year. User input Enter a year: 1600 1600 is a leap year. User input w Enter a year: 2008 2008 is a leap year User input Hint: Use if else statements inside the if and else blocks

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Processing Fundamentals Design And Implementation

Authors: David M. Kroenke

5th Edition

B000CSIH5A, 978-0023668814

More Books

Students also viewed these Databases questions