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
The Huntington Boys and Girls Club is conducting a fundraiser by selling chili dinners to go. The price is $7 for an adult meal
sweet-ann [11.9K]

Answer:

Hi Um how do i create an answer/question on here? I have a question about aa qestion on my quiz

Explanation:

7 0
3 years ago
Give two examples of desktop publishing software
soldier1979 [14.2K]
There are quite a lot of desktop publishing software as of today.
I'll give you the names of some of it.
- Adobe inDesign - one of the most popular
- Corel Draw
- Microsoft Publisher
- Serif
- Ultra Xml
And more.
There are actually a lot if you are just about to check in the internet.
7 0
3 years ago
What element is not a selection in the Interface preferences? UI Character Presets UI Font Size UI Language UI Scaling
Dovator [93]

Answer:

The element is not a selection in the Interface preferences is:

UI Character Presets

Explanation:

The interface preferences is a  section of the Set Preferences dialog, which contains settings related to the user interface for the display and configuration of certain features and dialogs, in accordance with the user's preferences.  They include the UI Font Size, UI Language, and UI Scaling, with the exception of the the UI Character Presets.  The UI Scale is the frontend extension of the actual screen resolution to the user.  The UI Language configures the user's preferred language, just as the UI Font Size allows the user to choose a preferred font size for display on the screen.

6 0
3 years ago
Nonverbal messages from the movie it​
RUDIKE [14]

Answer:

ya you say right

Explanation:

5 0
3 years ago
Read 2 more answers
Suppose that outfile is an ofstream variable and output is to be stored in the file outputData.out. Which of the following state
katrin [286]

Answer:

outFile.open("outputData.out");

4 0
3 years ago
Other questions:
  • In Microsoft Word, when you highlight existing text you want to replace, you are in what
    11·1 answer
  • Which of the following should you always wear to avoid being thrown from a vehicle and then crushed if it tips over?
    12·2 answers
  • When a range of IP addresses is set aside for client devices, and one of these IPs is issued to these devices when they request
    14·1 answer
  • Write a program that tells what coins to give out for any amount of change from 1
    6·1 answer
  • When working with arrays, most programming languages perform ________, which means they do not allow programs to use invalid sub
    5·1 answer
  • One problem with _______ is that often many copies of the same document are made. <br><br>HELPPP ​
    11·1 answer
  • Who here has a crush on jk from bts but feels more mature than him
    10·2 answers
  • Help me and i'll mark brainliest
    9·1 answer
  • Which is an example of machine-to-machine communication?
    7·1 answer
  • You want to add a caption to a table. which tab contains this option?.
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!