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
natulia [17]
3 years ago
11

# line 1 age = int(input("Enter your age: ")) # line 3 print("Invalid input") If we want the computer to display "Invalid input"

whenever a floating point number such as 20.5 is entered by the user, what should be inserted in line 1 and line 3?

Engineering
1 answer:
user100 [1]3 years ago
5 0

Answer:

Insert

'try:' at line 1

'except:' at line 3

Explanation:

The "try and except" commands in Python are used for exception handling.

try: the statements under this block are executed normally

except: the the statements under this block are executed when there is an exception.

We can use these commands to handle errors, for example, in the given scenario we don't want the user to enter a floating point number such as

1.5, 2.6 etc.

When the user enters an integer number then the except command is not executed.

When the user enters a floating point number then the except command is executed, program is stopped and error message is shown that is at line 4

Python code:  

# line 1

try:

# line 2

   age = int(input("Enter your age: "))

# line 3

except:

# line 4

   print("Invalid input")

Output:

Test 1:

Enter your age: 20

Test 2:

Enter your age: 20.5

Invalid input

You might be interested in
A light train made up of two cars is traveling at 90 km/h when the brakes are applied to both cars. Know that car A has a mass o
posledela

Answer:

a) d=236.280\,m, b) F_{coupling} = -8848\,N The real force has the opposite direction.

Explanation:

a) Let assume that train moves on the horizontal ground. An equation for the distance travelled by the train is modelled after the Principle of Energy Conservation and Work-Energy Theorem:

K_{A} = W_{brake}

\frac{1}{2}\cdot m_{train} \cdot v^{2} = F_{brakes}\cdot d

d = \frac{m_{train}\cdot v^{2}}{2\cdot F_{brakes}}

d = \frac{(51000\,kg)\cdot [(90\,\frac{km}{h} )\cdot (\frac{1000\,m}{1\,km} )\cdot (\frac{1\,h}{3600\,s} )]^{2}}{2\cdot (82000\,N)}

d=194.360\,m

b) The acceleration experimented by both trains are:

a = -\frac{v_{o}^{2}}{2\cdot d}

a = -\frac{[(90\,\frac{km}{h} )\cdot (\frac{1000\,m}{1\,km} )\cdot (\frac{1\,h}{3600\,s})]^{2}}{2\cdot (194.360\,m)}

a = -1.608\,\frac{m}{s^{2}}

The coupling force in the car A can derived of the following equation of equilibrium:

\Sigma F = F_{coupling} - F_{brakes} = m_{A}\cdot a

The coupling force between cars is:

F_{coupling} = m_{A}\cdot a + F_{brakes}

F_{coupling} = (31000\,kg)\cdot(-1.608\,\frac{m}{s^{2}} )+41000\,N

F_{coupling} = -8848\,N

The real force has the opposite direction.

8 0
3 years ago
Select the statement that is false.
ra1l [238]

Answer:

D

Explanation:

the way vertices are connected may be different so having same number of edges do not mean that total degree will also be same.

8 0
3 years ago
A six-lane freeway (three lanes in each direction) with a 5.5% uphill grade 1.5 miles long has 10-ft lanes and obstructions 5 ft
sertanlavr [38]
The answer would be:
A. LOS B
4 0
3 years ago
Read 2 more answers
9.For a single-frequency sine wave modulating signal of 3 kHz with a carrier frequency of 36 MHz, what is the spacing between si
nikdorinn [45]

The spacing between sidebands is equal to 6 kHz.

<u>Given the following data:</u>

  • Modulating signal = 3 kHz.
  • Carrier frequency = 36 MHz.

<h3>What is a sideband?</h3>

A sideband can be defined as a band of frequencies that are lower or higher than the carrier frequency due to the modulation process. Thus, it will either be lower than or higher than the carrier frequency.

Generally, the frequency of the modulating signal is equal to the spacing between the sidebands. Therefore, a modulating signal of 3 kHz simply means that the lower sideband is <u>3 kHz</u> higher while the upper sideband is <u>3 kHz</u> lower.

Spacing = 3 kHz + 3 kHz = 6 kHz.

Read more on frequency here: brainly.com/question/3841958

8 0
2 years ago
You are diving a car out in rural America and suddenly you get a flat tire. you pull off to the side of the road. you check your
julsineya [31]

Answer:

Walk to saftey!

Explanation:

4 0
3 years ago
Other questions:
  • The specific volume of a system consisting of refrigerant-134a at 1.0 Mpa is 0.01 m /kg. The quality of the R-134a is: (a) 12.6%
    15·1 answer
  • slader A heat pump cycle is used to maintain the interior of a building at 15°C. At steady state, the heat pump receives energy
    7·2 answers
  • Type the correct answer in the box. Spell all words correctly.
    11·1 answer
  • Which of the following justifies the need for an already-certified engineer to continue to take classes?
    15·1 answer
  • A 20 mm diameter rod made of ductile material with a yield strength of 350 MN/m2 is subjected to a torque of 100 N.m, and a bend
    8·1 answer
  • Compare and contrast the three USDA quality grades available to consumers and describe how the grades affect labeling.
    14·1 answer
  • What relationship is there between the hydraulic system and power, force, energy, resources, and types of energy?
    11·2 answers
  • Moonbeam-Musel (MM), a manufacturer of small appliances, has a large injection molding department. Because MM's CEO, Crosscut Sa
    13·1 answer
  • What information you would gain by watching the video. Plz Help due today.
    6·1 answer
  • What is the design wind speed for average-risk building:_____.
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!