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.

Answers

Answer 1

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.


Related Questions

Computer Science uses the power of ______________ to solve problems.

Answers

Computer Science uses the power of computers to solve problems.

Linux does not provide a GUI for its users.
-True
-False

Answers

Answer:

False

I know for a fact this is false.

Brainliest?

Answer:

it is false why would they not

Write an algorithm for a program which inputs the lengths a, b and c of the three sides of a triangle. The program then determines whether the triangle is right-angled and prints out a message to say whether or not the triangle is right angled. You may assume that a is the longest side.

Answers

Answer:

Algorithm:

Step 1: Start

Step 2: Declare variables a,b,c

Step 3: Input a,b,c

Step 4: If a^2 == b^2 + c^2

                  Display "The triangle is right angled"

            Else

                  Display "The triangle is not right angled"

Step 5: Stop

Explanation:

A triangle is right angled if the square of the largest side equals the sum of the square of the other two sides

The algorithm will be based on the above analysis.

This indicated the start of the algorithm

Step 1: Start

This declares required variables

Step 2: Declare variables a,b,c

This gets values for the declared variables

Step 3: Input a,b,c

This checks for the condition to determine right angled triangle

Step 4: If a^2 == b^2 + c^2

If true, this message that states the triangle is right angled is printed

                  Display "The triangle is right angled"

If otherwise

            Else

This message that states the triangle is not right angled is printed

                  Display "The triangle is not right angled"

This indicates the end of the algorithm

Step 5: Stop

The algorithm when implemented in Python is as follows:

a = float(input("a: "))

b = float(input("b: "))

c = float(input("c: "))

if a**2 == b**2 + c**2:

   print("The triangle is right angled")

else:

   print("The triangle is not right angled")

It follows the same explanation as the algorithm

Choose a half-hour television program, watch it, and take notes. It can be any program.

Answer the following questions about this program:

What behaviors do you think someone might learn from watching this program?
What attitudes might someone learn from watching this program?
What messages about social norms might someone learn from watching this program?

Answers

Answer:

Here's my answers.

Explanation:

I think, that from watching this program, the person watching may learn about supernatural (and fictional) abilities, and probably start to watch more of it.

The attitudes someone might learn from this program are funny attitudes, smart attitudes, and calm attitudes.

The messages about social norms that someone might learn from watching this program are that it's perfectly okay to run up to your adopted brother who has been ruining your life, tried to steal your girlfriend, and burned your dog alive and punch him hard in the face.

(The series, if you haven't guessed it already, is JoJo's Bizarre Adventure.)

Select all the lines that have a slope of 5/2

Answers

Answer:

Add a picture, then ask the question again.

"prevention is better than cure" Justify this statment.​

Answers

Answer:

Hope

you like it and helpful

Step into my world
Bittersweet love story about a girl
Shook me to the core
Voice like an angel, I've never heard before
Here in front of me
Shining so much brighter than I have ever seen
Life can be so mean
But when he goes, I know he doesn't leave

[Pre-Chorus 1: Charlie Gillespie & Madison Reyes]
The truth is finally breaking through
Two worlds collide when I'm with you
Our voices rise and soar so high
We come to life when we're

[Chorus: Charlie Gillespie & Madison Reyes]
In perfect harmony
Woah, woah
Perfect harmony
Woah, woah
Perfect harmony

[Verse 2: Charlie Gillespie, Madison Reyes, Charlie Gillespie & Madison Reyes]
You set me free
You and me together is more than chemistry
Love me as I am
I'll hold your music here inside my hands

[Pre-Chorus 2: Charlie Gillespie & Madison Reyes]
We say we're friends, we play pretend
You're more to me, we're everything
Our voices rise and soar so high
We come to life when we're

[Chorus: Charlie Gillespie & Madison Reyes]
In perfect harmony
Woah, woah
Perfect harmony
Woah, woah
Perfect harmony

[Bridge: Charlie Gillespie, Madison Reyes, Charlie Gillespie & Madison Reyes]
I feel your rhythm in my heart, yeah-yeah
You are my brightest, burning star, woah-woah
I never knew a love so real (So real)
We're heaven on earth, melody and words
When we are together we're

[Chorus: Charlie Gillespie & Madison Reyes]
In perfect harmony
Woah, woah
Perfect harmony
Woah, woah

[Outro: Charlie Gillespie, Madison Reyes, Charlie Gillespie & Madison Reyes]
We say we're friends
We play pretend
You're more to me
We create a perfect harmony

Answers

Answer:

THIS SONG IS FIRE AND WHEN IT HAPPENED IN THE SHOW, I FAINTED*

Explanation:

Julie and the Phantoms is my favorite thing in the world.

WHERE DO I GO TO DO THIS AND WHAT DO I WRITE?????
Write a pseudocode plan for your program.
Write the code for your program.
Test your program. Run it at least three times with different inputs.
Save your program as a .txt file for you cannot upload a .py file.
Evaluate your project using this rubric.
What to Submit
Submit the .txt file holding your program.

Answers

You can just look up "python ide online" on google and paste this code:

n = -1

count = 0

while n < 0:

   n = int(input("We're checking to see if a number is prime or not! Enter a positive number: "))

if n % 2 == 0:

   if n == 2:

       print("{} is a prime number".format(n))

   else:

       print("{} is not a prime number".format(n))

else:

   for x in range(n, 1, -1):

       if n % x == 0:

           count += 1

   if count > 1 or n == 1:

       print("{} is not a prime number".format(n))

   else:

       print("{} is a prime number".format(n))

I've written some code that checks to see if a number entered by the user is a prime number or not.

Sorry, but I'm not too good with pseudocode plans and all that. I hope this helps.

Answer:

import math

print("Let's solve ax² + bx + c = 0")

a = int(float(input('Enter a value for a: ')))

b = int(float(input('Enter a value for b: ')))

c = int(float(input('Enter a value for c: ')))

D = b*b-4*a*c

if (D<0):

   print("Sorry, this equation has no solutions.")

elif (a == 0):

   if (b == 0):

       if (c == 0):

           print("Every value of x is a solution")

       else:

           print("Sorry, this equation has no solutions")

   else:

       x = -c/b

   print("The one solution is x={:.3g}".format(x))

elif (D==0):

   x = (-b + math.sqrt(D)) / (2*a)

   print("The one solution is x={:.3g}".format(x))

else:

   x1 = (-b + math.sqrt(D)) / (2*a)

   x2 = (-b - math.sqrt(D)) / (2*a)

   print("This equation has two solutions: x={:.3g} or x={:.3g}".format(x1, x2))

Explanation:

Above is another little program to use the quadratic formula.

Mary Grossman has been selling cupcakes for the past few years. She keeps meticulous record of every cupcake that she has ever made and sold. She has also kept records of customers’ comments on all her cupcakes. These have been entered into a computerized accounting information system that her accountant refers to as a "data warehouse." Mary is considering rebranding her cupcake business and has asked her accountant to identify the top-selling cupcakes for the past few years. Mary wants her accountant to engage in:______.

Answers

Answer:

Data mining

Explanation:

Based on the information given we were told that she is considering the rebranding of her cupcake business in which she asked her accountant to help her identify her top selling cupcakes for the past few years which means Mary want to make use of the large information recorded into the Data warehouse to improve her business.

Hence we can say that she wants her accountant to engage in DATA MINING.

DATA MINING can be defined as the process of making use of information collected or data collected to help know business lapses for the sole aim of improving the business and to help use the data collected to make goods business choices.

Therefore Mary wants her accountant to engage in DATA MINING

what is mainframe computer​

Answers

Answer:

Explanation:

it's a computer that is used by large companies for applications. For example, a census taker might use a mainframe computer. It's mainly used for bulk data processing .

__________for about 10 minutes in between each repetition session helps you to remember the information better. a. Reading c. Sleeping b. Resting d. None of these

Answers

the answer is a.) reading

Answer:

Hey make sure you REST before school ( Its b. resting)

Explanation:

I hope everyone that sees this has a wonderful day and if your not hopefully this cat and dog will make you feel better, BYE LOVIES!!

What does it mean to be proactive about internet safety?
Spending as little time online as possible to reduce the risk of problems.
Predicting problems before they happen so you can avoid them.
Finding the best way to solve a current problem so you can use it later.
Facing up to the consequences of your mistakes so you can learn from them.

Answers

Answer:

Predicting problems before they happen so you can avoid them.

Explanation:

You should avoid causing trouble, or partaking in it. Being safe on the internet helps reduce bullying, threats, depressing behavior, etc.

I do agre the answer is shoving a stick in dirt

the contents in cells are A1 through A6 are 6,3,4,7,9 and 7. What function would return the answer 6?​

Answers

Explanation:

hsidjdujdn I have been trying the new year with everything else was there to

Any application that wants to be displayed on the web must use the HTTP protocol
True
False

Answers

Answer:

true

Explanation:

4.8 Code Practice: Question 3

Answers

for x in range(200, 301, 2):

   print(x)

I hope this helps!

The code practice is an illustration of loops;

Loops are statements that are used to perform repeated actions

The complete program in Python

The program in Python, where comments are used to explain each action is as follows:

#This iterates from 200 to 300

for i in range(200,301,2):

#This prints the even numbers

   print(i)

Read more about loops at:

https://brainly.com/question/24833629

#SPJ2

Someone plz im begging for ur help plzz??

Answers

Answer:

woah what subject is this-

Explanation:

The ______ is designed to store audio data on computers and/or digital music players.

A. waveform
B. audio file format
C. sample rate
D. bandwidth

Answers

Answer:

audio file formats of computer

I NEED HELP ASAP IM BAD AT THIS

Answers

A float is a floating point number. This means that's the number has a decimal place. Numbers with or without decimal places can be stored in a float variable but more commonly numbers with decimal points.

The correct choices are 1 and 3.4

The complete process for learning through repetition is to read, write, say, rest and revisit the information. Please select the best answer from the choices provided T F

Answers

Answer:

True.

Explanation:

The complete process for learning through repetition is to read, write, say, rest and revisit the information.

This ultimately implies that, when an individual indulge in learning through repetition, he or she would is strengthening the single memory trace and as such enhancing the learning process.

Hence, learning through repetition such as reading, writing, saying, resting and revisiting the information is very effective because it engages and activates the visual, auditory, tactile and kinesthetic neural pathways to the brain.

Additionally, it is advisable to wait for about ten (10) minutes in between the repetition process when learning through repetition.

Answer:

True

Explanation:

Just took the quiz.

Can someone help me please?

Answers

Answer:

WAN is correct.

Explanation:

Typically, a WAN consists of two or more local-area networks (LANs).

Answer:

yes it is WAN:)

Explanation:

^_^your welcome

Need help pleaseeee!!!!!

Answers

Answer:

Attenuation

Explanation:

This means the signal is getting weaker in long cables.

How has technology effected the way we communicate?

Answers

Indeed it has.

Advancements in technology and changes in communication generally go hand in hand. Landlines displaced the telegraph and cell phones replaced landlines. The arrival of the internet opened new doors of personal communication. E-mails replaced postal mails and social media took the place of text messages.

Communication technology, such as mobile phones, email, text messaging, instant messaging and social networking have had a profound effect on nearly everyone's business and personal lives. While technology makes communications faster and easier, at times it can also be intrusive and misinterpreted.

Increased isolation, reduced social interaction and social skills, and increased human-to-machine interactions are all a result of an overuse of technology, which has created a wall between many people globally.

Technology has the ability to enhance daily living from appliances to mobile devices and computers, technology is everywhere. ... In the rise of digital communication, technology can actually help communication skills because it allows people to learn written communication to varying audiences.

-Astolfo

What is GIGO ?
plz answer me​

Answers

Answer:

Garbage in, garbage out

Explanation:

In computer science, garbage in, garbage out is the concept that flawed, or nonsense input data produces nonsense output or garbage

PLEASE HURRY

If a flowchart has a diamond with the words "yes" and "no" to the sides of it, then it is representing a program that is a sequence O True O False​

Answers

Answer:

its true

Explanation:

what do you think about when you enter school​

Answers

Answer:

i think my day is about to start and i'm going to get the chance to finally talk to my best friends on D!$C0rD, and then i think about how my parents are rUDe for not letting me talk to my friends. :/

Not again

Or

I’m going to end my life today

I don’t like school

Problems that are undecidable and algorithms that are unreasonable both touch on the limits of the kinds of computing
that a computer can accomplish. In your own words, explain the difference between undecidable problems and
unreasonable time algorithms.

Answers

Answer:

An unsolvable problem is one for which no algorithm can ever be written to find the solution. An undecidable problem is one for which no algorithm can ever be written that will always give a correct true/false decision for every input value.

Undecidable problems simply describes problems which do not have the algorithm to produce the required 'yes' or 'no' solution while unreasonable time algorithm are those problems which run time grows exponentially.

A problem is tagged as Undecidable if no algorithm exists to allow such problem produce a 'yes' or 'no' solution. Hence, undecidable problems would sometimes run infinitely or give a wrong output in some cases.

Unreasonable time algorithm describes problems whose run time increases in an exponential nature. Such programs increases in run time very quickly due to the nature of the of the computation. Example ; 10^n.., where n is a range of values.

Therefore, both undecided and unreasonable time algorithm affects the limits of computing attainable by different computer systems.

Learn more :https://brainly.com/question/21242780?referrer=searchResults

where can you apply the hand wire splicing technique

Answers

Answer:

When you want to extend an electrical wire for an apparatus, e.g., a lamp or a speaker.

Beth earned a bachelor’s degree and has worked as a systems analyst for three years. Which of the following has Beth acquired? experience data information knowledge
A.experience
B.Data
C.information
D.Knowledge

Answers

A experience


Explanation

Because it shows that she knows what she is doing since she has earned a bachelors degree in this field.

Modern commercial air travel is more akin to urban mass transit than it is to recreational travel true or false?

Answers

Answer:

true

Explanation:

because who knows how it works that way

Answer:

false

Explanation:

i got it right

Why do software developers prefer to use high-level language to author programs?
It can be used on computers without microprocessors.
It prevents anyone from making changes to the software later.
It uses a more English-like syntax.
It’s less complicated because it only uses zeros and ones.

Answers

Answer:

The answer to this question is given below in the explanation section

Explanation:

The correct answer to this question is: it used a more English-like syntax.

The software developer use high-level language to develop or author the program because it is more likely to English syntax and it would be easy for a software developer to author a program easily instead of using low level language and remembering ones and zeros.

Other options are not correct because:

It can be used on computers without microprocessors: Each computer has a microprocessor either you develop a program using high-level or low-level languages. Changes and modifications are easy in high-level language than in low-level languages. so, the option that prevents anyone from making changes to the software later is wrong.  However, high-level languages are less complicated in learning and in authoring the programs but it does not use zeros and ones, it uses English-like syntax. So, the last option is also wrong.  

Answer:

b

Explanation:

Other Questions
Question 12 (1 point)What the "t" ending for an "ir" verb?ises 50 chemical equations I NEED HELP WITH THEM ALL PLEASE what does the old three hundred mean can someone please help me;/Which made Atlanta an important city for the Confederacy? Check all that apply.It was located on the Mississippi.It was located near the Union states.It was a communications center.It was a transportation hub.It was a manufacturing center.It was a center of learning. A solid substance was tested in the laboratory. The test results are listed below: 1.) dissolves in water 2.) is an electrolyte 3.) melts at a high temperature. Based on these results, the solid substance could be .............llllllllllllllllwwwwwwww After the addition of the iron, the test tube now contains iron (II) sulfate solution and copperparticles. The iron has become part of aAcompound with the sulfate, which must be separated through chemical methodsBcompound with the sulfate, which can be separated through physical methodsC.mixture with the sulfate, which must be separated through chemical methodsD. mixture with the sulfate, which can be separated through physical methods Part of a chemical equation is shown below 2koh + h2so4 .Wich pair of chemicals most likely comes after the arrow to complete the equation. someone help me Please The ratio of the number of boys to the number of girls in a dance club is 5 : 6. After 6 more boys join the club, the ratio became 13 : 12. How many people were in the club at the start? Which type of court system functions to determine the liability of the defendant? Limited jurisdiction court systems Supreme court systems Criminal court systems Civil court systems In the "Lunch Tray Adventures": Qui a la personnalit la plus sarcastique dans cet pisode?MorganSandyles extra-terrestresO le bouton jaune In the diagram below, line segment AB has endpoints at A(-2,-6) and B (3,-1). Give the coordinates of line segment A'B' after a counterclockwise rotation of 90 about the origin. Fill in the BlankComplete the following sentence. Remember to spell correctly.The most common biomass iswhich people have used to heat their homes for centuries. describe the effects that enzymes can have on substrates how were the ancient Egyptians advancements in the field of astronomy and mathematics helpful to Farmers This document is known as which of the following?theonsO A. the Israel AccordsOB. the Palestine MandateO c the Balfour DeclarationTNoD. the Camp David Accords Punctuate the following sentence correctly using commas, semicolons, or colons.I have not eaten any of the following vegetables green beans, brussels sprouts, cabbage, and asparagus.A. I have not eaten any of the following vegetables: green beans, brussels sprouts, cabbage, and asparagus.B. I have not eaten any of the following vegetables; green beans, brussels sprouts, cabbage, and asparagus.C. I have not eaten any of the following vegetables, green beans, brussels sprouts, cabbage, and asparagus.D. I have not eaten any of the following vegetables green beans, brussels sprouts, cabbage, and asparagus. Timothy has some coins in a jar. He has 6 pennies,8 nickels,10 dimes, and four quarters. What is the ratio of the number of nickels to the number of dimes