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
Murljashka [212]
3 years ago
15

Why is this python code giving me problems?

Computers and Technology
1 answer:
dalvyx [7]3 years ago
6 0

Answer:

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

Explanation:

The given code in this program has syntax errors.

In the given code, at line 1, input will cast or convert to int. It will generate an error on the second line because integer numbers can't be rounded. In simple, integer numbers don't have decimals. So, to correct the line you must use float instead of int.

In the second line, you need also to emit the int casting (data type conversion), because you have already converted the input into the float. In line 3, the second parameter to print function is num3, not x.

So the correct lines of the python code are given below:

num3 = float(input("Please input a decimal number:"))

num3 = (round(num3, 2))

print ("your decimal rounded to the 2nd decimal place is:", num3)

 

When you will run the above bold lines of code, it will run the program successfully without giving you any syntax and semantic error.

You might be interested in
Which feature enables you to make changes to all the slides of your presentation at the same time?
vesna_86 [32]

Answer:

Slide master

Explanation:

The slide master in PowerPoint is a useful tool that is used to quickly make changes to fonts, themes, colors, and many more. Once these changes are adjusted to the user’s liking, they will be applied to all available slides all at once. To open the slide master, click the view tab and select the slide master option.

4 0
3 years ago
Read 2 more answers
The ___________ method returns the length of an array.
MaRussiya [10]

Answer:

A. Append

Explanation:

4 0
3 years ago
Read 2 more answers
Read the following code:
sergejj [24]

Answer:

0

1

2

3

4

5

Explanation:

The loop first prints when n is still 0, so 0 is in the list.

The loop still executes when n = 5, so 5 must also be in the list.

6 0
3 years ago
When communicating with sockets, a client process initiates a request for a connection and is assigned a port by the host comput
melamori03 [73]

Answer:

D. 80

Explanation:

By default, the port number for a web server is 80.

3 0
4 years ago
Read 2 more answers
Test if the word mold is stored in the variable word. Computer science.
Andre45 [30]

Answer:

word = str("Enter a word: ")

if "mold" in word:

 print("Mold is in the variable word.")

else:

 print("Mold is not in the variable word.")

5 0
3 years ago
Other questions:
  • At an open or uncontrolled intersection, yield if ____.
    11·2 answers
  • When computer manufacturers overcame the enormous 13,000 Chinese character barrier by creating a workable keyboard through voice
    15·1 answer
  • If someone receives a shock, or a piece of equipment is throwing sparks or arcing you should try to pull them away from the sour
    7·1 answer
  • Quien invento el primer vehiculo con motor?
    15·2 answers
  • Employees don't have to comply with PPE requirements if they feel the PPE isn't necessary for the particular task they performed
    14·2 answers
  • Windows OS and Mac OS are examples of which type of operating systems?
    5·1 answer
  • Many electronic devices use a(n) ?, which contains all the circuit parts in a miniature form.
    14·2 answers
  • unlike tv or newspaper ads, internet communications are interactive, and consumers can choose which messages and information the
    5·1 answer
  • 3. It is important to make certain that your employees are aware of the work ethic
    13·1 answer
  • A technician is troubleshooting a Windows computer and needs to stop the explorer.exe process.Multiple attempts to open Task Man
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!