python 3.4 code practice question 2

“Write a program to convert a fraction to a decimal. Have your program ask for the numerator first, then the denominator. Make sure to check if the denominator is zero. If it is, print out “Error - cannot divide by zero.”

Answers

Answer 1

numerator = int(input("Enter a number: "))

denominator = int(input("Enter a number: "))

if denominator != 0:

   print(numerator/denominator)

else:

   print("Error - cannot divide by zero.")

Answer 2

The fraction can only be described as "undefined" if the denominator is ever 0.

Explain about the denominator is zero?

The mathematical error (not specified) of dividing a number by zero can be graciously overcame by using exception handling. The output of division by zero will be displayed as infinity if you write code without employing exception handling, which cannot be further processed.

A fraction cannot have zero as the denominator since zero cannot be divided by anything. The reason is that you get back 6 when you multiply the answer, 2, by the divisor, 3. Because the denominator cannot be zero, the fraction is invalid and has no value.

"Enter a number: " input = int numerator

Denominator: int ("Enter a number: "); input;

if the numerator!= 0

print(numerator/denominator)

else:

print("Error - cannot divide by zero")

("Error - cannot divide by zero.")

To learn more about denominator is zero refer to:

https://brainly.com/question/17546250

#SPJ2


Related Questions

______________ is a pre-designed format to help users with the creation of a document, like a flyer, brochures, or resumes. What's the answer for the blank?

A.PowerPoint
B.Excel
C.Template
D.Pie Chart

Answers

The answer should be Template

Which of the following should you consider when choosing a file format?

the browser you use most often

the age of the person who created the file

the need for future access and digital preservation

the length of time a file is under copyright law​

Answers

Answer:

“The need for future access and digital preservation”

Explanation:

When choosing a file format, it is important to consider the need for future access and digital preservation. The correct option is 3.

What is file format?

A file format is a method of organizing and storing data in a file that is standardized. It specifies how data in the file is organized and represented.

It is critical to consider the need for future access and digital preservation when selecting a file format.

This is due to the fact that different file formats have varying levels of compatibility with different software and operating systems, and some formats may become obsolete over time, making future access or opening of the file difficult or impossible.

Other factors to consider when selecting a file format include the intended use of the file, the file's quality and size, and any specific requirements or limitations of the software or platform being used.

Thus, the correct option is 3.

For more details regarding file format, visit:

https://brainly.com/question/1856005

#SPJ7

yoooooo guys what up

can yall help
In three to five sentences, compare and contrast paraphrasing and summarizing.
will mark brainlist

Answers

Answer:

To put simply, paraphrasing refers to the conversion of the original or the concerned source material into the own or personal words of the reader or the interpreter. In contrast, summarizing mainly refers to the conversion of the main idea/concept/s or content of any original text or source material into the writer's or interpreter's own words.

Explanation:

Paraphrasing commonly engages putting any original text of any source material into the own words of the reader or the interpreter of the material.On the other hand,summarizing mainly involves converting the central idea/s or the content/s of the source material into the own words of the reader or interpreter of the source material.

Paraphrasing involves selection of any specific broader section or part of the source material and its conversion into a shorter version in terms of the own words of the reader or the interpreter,whereas,summarizing construes selection of the overall of main idea/s or content of the source material and putting it into a condensed form,expressed in the own words of the reader or interpreter.

being a media and information literate indibidual is important especially during this modern time.give atleast three example situations that show its importance in your daily life​

Answers

Answer:

I REQUIRE POINTS CAUSE I NEED ASWERS FOR M HOMEWORK

Explanation:

DO NOW
1. What are the 4 things that make a computer a
computer?

Answers

Answer:

CPU, GPU, Hard drive, Video Card

Explanation:

what are the important reason to practice Opreational Health and Safety procedure?

Answers

To prevent injury

to protect the environment

its the law you can get fined a lot of dollars

Hope you get the question right :)

why do many experts recommand longer time horizonal if you are doing high risk investment

Answers

Answer:In general, the longer your time horizon, the better you can handle fluctuations in value and take more risk in order to reap greater rewards.

Explanation:

Two types of are desktop computers and notebook computer

Answers

Answer:

personal computer is the correct answer.

Two types of personal computer are desktop computers and notebook computer. Thus, option A is correct.

Today personal computer is changed to laptop mode. Personal computer is made of CPU, monitor, keyboard, printer and mouse. All input device and output device connected with wire or without wire.

Personal computers are also called as desktop or workstation. These days all become compatible device which is called as laptop. Basically all input devices and output device are fixed in laptop so end user can carry the laptop and used anywhere.

Laptop is charged and used, whereas desktop or workstation just fixed in the table and used it.

Learn more about computer on:

https://brainly.com/question/32297638

#SPJ2

What are the requirements to access email on the web?

A. a webmail provider's URL and a password
B. a webmail provider's URL a username and a password
C. a credit or debit card, a username, and a password
D. an email server ID and a password

Answers

Answer:

it's B

Explanation:

You need to have a provider (such as outlook) and a username/password

It’s either A or D u Choose now

There are many apps that help find you cheaper gas. If the cost of a gallon of regular gas is $3 at one station and $3.50 at another gas station and your car takes 12 gallons to fill up your car. How much extra are you spending at the more expensive gas station? $5 $6 $7 $8

Answers

Answer:

$7

Explanation:

Question #3
Multiple Select
Which statements are true about a user-defined data type? Select 3 options.
It can only include one data type.
I
It can include bool data.
It cannot be changed once you define it.
It can include string data.
O It can include numeric data,

Answers

An attribute of a piece of data known as a “data type” instructs a computer system how to interpret that data's value.

What are the different type data type and their uses?

Data is categorized into different types by a data type, which informs the compiler or interpreter of the programmer's intended usage of the data.

Most computer languages provide a variety of data types, including integer, real, character or string, and Boolean.

The operations that can be performed to create, alter, and use the variable in another calculation without running the risk are specified by the data type.

Knowing the various types of data makes it easier to make sure that the values of each property are as expected and that the data is gathered in the right format.

A programming language is said to be strongly typed if it only permits operations on variables that respect their data type.

Therefore, It can include string data, bool data, numeric data.

Learn more about data type here:

https://brainly.com/question/14581918

#SPJ2

Answer:

A D E

Explanation:

. While ________is the protocol used to view web pages, browsers also support protocols for functions such as transferring large files.

A)HTML
B)HTTP
C)FTP

Answers

Answer:

HTTP

Explanation:

Answer:

B) HTTP

Explanation:

This is hypertext transfer protocol.

White lines
A.separate traffic lanes moving in opposite directions
B.separate traffic moving in the same direction
C.indicate a handicap parking space
the
D.indicate temporary parking

Answers

Answer:

Its B                                                                                                                                            

Explanation:

Answer: B

Explanation:

Which of the following represents a backup system that will aid in recovery for any type of disaster or disruption?

Transfer operations
Integrity operations
Redundancy operations
Independent operations

Answers

Answer: redundancy operations

Explanation:

Other Questions
How many moles are in 4.35 X 1024 atoms of Iron (Fe)? Who or what positions are in the Executive Department? Can somebody help me with this question plz! Which of the following choices was the result of the other three? A. The U.S. cut off supplies of steel and oil to Japan. B. The U.S. sent land-lease aid to China, who was being targeted by Japan. C. The U.S. froze all Japanese assets. D. The Japanese attacked Pearl Harbor, Hawaii. Where to put 1/2 on a number line say something mean to me Look at the picture below.What will happen to thewater if it is left in the sunfor an extended amount oftime? The density of a metal is 11.4 g/cm3. How much volume (in cm3) would a sample of 30.5 g have? PLEASE ANSWER FAST.one of the barriers for early "talkies" was the need to manually crank the projector and manually synchronize the audio and film, which resulted in uneven quality based on operator skill true or false How do I Simplify 5(2x-4)-(-6x+3) True or false. You can use the slope to find a second point on a graph by starting at the y- intercept, and moving up (rise) & over (run) a certain amount of unit spaces. The process of diffusion occurs when Which of the following graphs is the solution set of 1/2 x + 7 > 3? m+7=3+m+4 what is the value of m What do you think a definite and indefinite article is? Which word from paragraph 3 means "take in" or "bring inward"?perceivedinternalizationconformitylabeled The Latin root word that means "stranger/enemy" is what are the similarities and differences between respiration and photosynthesis?? Can you guys help im kinda struggling which equation represents the line that passes through points (5,4) and (-5,0)