1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
ElenaW [278]
2 years ago
11

Write a Python function that takes a positive integer N and returns the factorial of N, i.e., N! The factorial of N, denoted N!,

is the product of the integers from 1 to N. (1 Point)
Computers and Technology
1 answer:
sesenic [268]2 years ago
6 0

Answer:

The python function is as follows:

def fact(N):

   factorial = 1

   for i in range(1,N+1):

       factorial = factorial * i

   return(factorial)

Explanation:

This line defines the function

def fact(N):

This line initializes the product of 1 to N to 1

   factorial = 1

This line iterates through 1 to N

   for i in range(1,N+1):

This line calculates the product of 1 to N i.e. factorial

       factorial = factorial * i

This line returns the factorial

   return(factorial)

You might be interested in
An ipv4 address in the range 169.254.0.1 through 169.254.255.254 indicates a problem with what type of service
DENIUS [597]

Dynamic Host Configuration Protocol, also known as DHCP.

3 0
3 years ago
A non technical kind of cyber intrusion that relies heavily on human interaction and often involve tricking people into breaking
lana66690 [7]
Social Engineering.

---------------------------
4 0
3 years ago
Which of the following electronic collaboration techniques is the best
muminat

Answer:

D. project management software

6 0
3 years ago
Read 2 more answers
Define and implement a method that takes a string array as a parameter and returns the length of the shortest and the longest st
Drupady [299]

Answer:

#HERE IS CODE IN PYTHON

#function to find length of shortest and longest string in the array

def fun(list2):

   #find length of shortest string

   mn=len(min(list2))

   #find length of longest string

   mx=len(max(list2))

   #return both the value

   return mn,mx

#array of strings

list2 = ['Ford', 'Volvo', 'BMW', 'MARUTI','TATA']

# call the function

mn,mx=fun(list2)

#print the result

print("shortest length is:",mn)

print("longest length is:",mx)

Explanation:

Create an array of strings.Call the function fun() with array as parameter. Here min() function will find the minimum string among all the strings of array and then len() function will find its length and assign to "mn". Similarly max() will find the largest string and then len() will find its length and assign to "mx". Function fun() will return "mn" & "mx".Then print the length of shortest and longest string.

Output:

shortest length is: 3

longest length is: 5

7 0
3 years ago
SOMEBODY HELP ME ASAP PLEASE AND THANK YOU
Paha777 [63]

Answer:

Isnt there another thing that is supposed to be there like some website

Explanation:

7 0
2 years ago
Read 2 more answers
Other questions:
  • Excel assigns the name ____ to the first excel table created in a workbook.
    10·1 answer
  • Why is e-mail better for informative and positive messages than for negative ones?
    6·1 answer
  • Which of the following is an accurate statement? When the LOWER function is used in a SELECT clause, it will automatically store
    6·1 answer
  • Discussion Six: Code of Ethics IT workers have many different relationships, including those with employers, clients, suppliers,
    7·1 answer
  • What type of function is being performed when a router screens packets based on information in the packet header
    8·1 answer
  • Seeing an error message on the screen after you click on a link or icon may indicate that your PC doesn't have the correct _____
    15·1 answer
  • 1) Using the density equation d=m/V: What is the density of a piece of metal with a mass o
    10·1 answer
  • Question 1
    10·1 answer
  • The advantage of using a spreadsheet is:
    14·1 answer
  • Attackers will sometimes put malware on USB drives and leave them in parking lots
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!