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
Consider the following code: def tryIt(b): for i in range(len(b)): b[i] = b[i] + 100 #***********MAIN************ x = [] x = [56
WINSTONCH [101]

Answer: I took a high school robotics class when I was in 5th grade and I don't even understand your code there aren't any instructions other than <em>"</em><em><u>Consider</u></em><u>"</u> the following code you may want to improve your question

7 0
3 years ago
What are the two elements of creating a flyer
Shtirlitz [24]
Idk but I use to know because I took computer classes
8 0
3 years ago
Read 2 more answers
Does technology get in the way of learning ?<br> Help Meh ! ♥ Some ideas :D
Nady [450]
Yes, and no, social network can distract a student like YouTube or face book, while it can be used as a tool for studying and to put your google documents in the cloud. plus if a teacher posts homework on his/her website, and you happen to forget the paper bringing it home, you can just simply print it instead of having to explain to the teacher
6 0
3 years ago
Read 2 more answers
Hi, I have several computer questions. These refer to the history of the internet. I would like to know if everything we look fo
MaRussiya [10]

<u>Hi dear user! </u>

<u>Hope my answer helps you and solve your queries. </u>

First of all,

ISP which is an acronym of Internet Service Provider, keeps the track of all the activities their users perform through their network.

For eg :-

You have a connection of Airtel, whatever you will access through your Airtel network will always be tracked by your ISP which is Airtel. If you delete your search/download history from your phone/laptop, still it can be seen by Airtel, you cannot delete from there end. Even if you access anything in incognito mode, then your browser does not stores your data but your ISP still can see what all you accessed in incognito mode.

Now coming to your next question,

If you delete your data from your phone or laptop, it is still somewhere saved in the hard drive of that device. The file is deleted from the device but it's hard drive still have that file, and anyone can access to that data by using a certain software but for that, the person will also need your hard drive. There are certain softwares like Disk Drill which is used to recover the hard drive's data.

Hope your queries are resolved !

7 0
4 years ago
56- What is the term used when you press and hold the left mouse key and more the mouse
elena55 [62]

Answer:

i'd say it's dragging, but i'm not 100% sure

Explanation:

8 0
2 years ago
Other questions:
  • Jack wants to store a large amount of data on his computer. He chooses to use a database for this purpose. What is a database? A
    8·1 answer
  • Assign to avg_owls the average owls per zoo. Print avg_owls as an integer. Sample output for inputs: 1 2 4 3
    7·1 answer
  • What does the Sort feature do with a database
    13·1 answer
  • The init() command initializes the task queue and scheduler data structures. run Next Task() MUST run to completion whatever tas
    9·1 answer
  • You are going to be installing a videoconferencing system. One of the requirements of the system is that only workstations that
    10·1 answer
  • A user reports his or her computer is slow to boot. You check the boot order and determine that the computer is checking the C d
    12·1 answer
  • Write an application named EnterUppercaseLetters that asks the user to type an uppercase letter from the keyboard. If the charac
    5·1 answer
  • Write an app that reads an integer, then determines and displays whether the integer is odd or even. [Hint: Use the remainder op
    10·1 answer
  • 4.2 lesson practice last one plzs help
    5·2 answers
  • Write a program that asks the user for the name of a text file. The program should display the first 10 lines of the file on the
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!