Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Python: Write a program that finds the solutions to the following formula with 1 decimal place accuracy. -10x^2+30x-20 > 0 In other words, the program

Python:

Write a program that finds the solutions to the following formula with 1 decimal place accuracy.

-10x^2+30x-20 > 0

In other words, the program will tell you at what x values, the above formula is greater than zero. The code should search in all numbers in the range of 1 to 10 (with the accuracy of 1 decimal place). If you have your code correctly, it should print the following result:

1.1

1.2

1.3

1.4

1.5

1.6

1.7

1.8

1.9

2.0

So only the numbers between 1 and 2 will result in the above formula become greater than zero.

VERY IMPORTANT NOTE: The range function will not accept a non-integer number (for example 0.1) as the step. Therefore, instead of going from 1 to 11 with the steps of 0.1, you can go from 1 to 110 with the step of 1. Before your calculation (inside the for loop) you should assign the counter variable to another variable and convert it to float, and divide it by 10. In other words, if your counter variable is num which is counting from 1 to 110 with the steps of 1, you need to use the following line inside the loop to convert it to a number that you can use:

converted_number = float(num) / 10

Now you can use the new variable converted_number in order to evaluate the above formula and see if it is greater than zero or not.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Object Oriented Databases Prentice Hall International Series In Computer Science

Authors: John G. Hughes

1st Edition

0136298745, 978-0136298748

More Books

Students also viewed these Databases questions