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
alex41 [277]
3 years ago
7

Write a python program to find factorial, use exception handling and display an appropriate message if the user inputs alphabets

instead of the number. Emulate Index error for a list and handle that exception. Find factorial for all numbers in a given list and display the result.
Computers and Technology
1 answer:
MrRissso [65]3 years ago
6 0

def func(lst):

   fac_lst = ([])

   try:

       for x in lst:

           i = 0

           fac = 1

           while i < x:

               fac *= (x - i)

               i += 1

           fac_lst.append(fac)

       return fac_lst

   except TypeError:

       return "Please input only numbers!"

   except IndexError:

       return "Please stay within the index!"

lst = ([1, 2, 3, 4, 5, 6, 7, 8])

print(func(lst))

I think this is what you're looking for. Best of luck.

You might be interested in
Please helpppppppppppppp
viktelen [127]

Answer:

its D

Explanation:

The social worker likes to work with other people, so he/she might not like working alone.

6 0
2 years ago
a third important logical element is the inverter. an inverter does pretty much what it says. if the input is 0, the output is 1
Mrrafil [7]

Answer:

xy225.252 <  \geqslant  > . \times 5 \times . =  {?}^{2}

7 0
3 years ago
Pictures that you can click on to tell your computer what to do.
Tom [10]
What do you mean ? I’m confused..
6 0
3 years ago
Read 2 more answers
Research different ways that 3D printing is used in society. Tell us about the items that are 3D printed.
Eva8 [605]

3D printing helps to reduce the time it takes for a manufacturer to create the product. This lets manufacturers invest their time to make flawless products because the production cycle time is reduced.

3 0
3 years ago
Read 2 more answers
Pls help help me is good help me helping is very good
skelet666 [1.2K]

Answer:

-56 negative

Explanation:

8 0
2 years ago
Other questions:
  • The spreadsheet below shows the age, grade level, major, and minor of four students in college. A purple background in the Major
    7·1 answer
  • In the file MajorSalary, data have been collected from 111 College of Business graduates on their monthly starting salaries. The
    15·1 answer
  • Jenny is the project manager and her company. She needs to break her current project into parts that her employees can work on.
    10·1 answer
  • What is one of the most effective security tools available for protecting users from external threats?
    15·1 answer
  • Create a program that includes a function called toUpperCamelCase that takes a string (consisting of lowercase words and spaces)
    9·1 answer
  • Someone help ASAP! Match the type of information system with its description.
    13·2 answers
  • All tif files start at offset 0 with what 6 hexadecimal characters?​
    11·1 answer
  • What should be done if a system cannot boot from the hard drive?
    14·1 answer
  • When looking at aggregated logs, you are seeing a large percentage of Windows hosts connecting to an Internet Protocol (IP) addr
    5·1 answer
  • You can resize a row in a table by dragging the ____.
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!