Question

In: Computer Science

(PYTHON)Your company prints math reference tables for high school and first year college students. You’d like...

(PYTHON)Your company prints math reference tables for high school and first year college students. You’d like to write a flexible program that will display the results for several mathematical functions applied to a range of integers, and the results displayed in a table with a header that includes labels separated by tabs:

Num Sqr SqRt Sin Cos Tan Log Log10

=== === ==== === === === === =====

Write a Python program that prompts the user for a starting integer, ending integer and interval (step) value. Based on these entries, and using functions from the Python math library, calculate and display each integer (x) along with the values for: x​2, sin x, cos x, tan x, log(x) and log10x .

Organize your file using comments for each block of planned code

Import the math library and initialize any necessary variables

Prompt the user for the starting, ending and interval values (integers)

Print the table headers

Create a loop based on the user’s values

Print the formatted values with 2 decimal places

There are four (4) parts to this program: 1. Import math library and initialize any necessary variables 2. Prompt the user for starting, ending and interval values 3. Create a for loop based on the values 4. Print each value and the calculated results as specified

Using the IDLE Python editor, enter the following comments in your Python program identifying each part. Make sure to leave blank spaces between each comment section.
# Initialize any necessary variables
# Prompt the user for the starting, ending and interval values
# Create a for loop based on the values
# Print each value and the calculated results as specified

Some hints and guidelines: • For the sin, cos and tan calculations, assume the user is providing values in degrees • The Python math library functions for sin, cos and tan expect a value in radians • Use the starting, ending and interval values to define your for loop • Round the results of the math calculations to 2 decimal places if necessary

Solutions

Expert Solution

compute.py-------

from math import * #importing math library

startingValue=int(input("Enter starting value : "))#taking starting value from user
endingValue=int(input("Enter ending value : "))#taking ending value from user
intervalValue=int(input("Enter interval value : "))#taking value from user

#table for x2
print('='*40,"\n\tx2")
print('='*40)
for i in range(startingValue,endingValue+1,intervalValue):
print("\t",i,"\t->\t",i*i)#calculating x2
print()
print('*'*40)
print("\n\n")

#table for sin(x)
print('='*40,"\n\tsin(x)")
print('='*40)
for i in range(startingValue,endingValue+1,intervalValue):
print("\t",i,"\t->\t%.2f" %sin(i*(pi/180)))#x in degree is converted to redain before calling sin(x) math library function
print()
print('*'*40)
print("\n\n")

#table for cos(x)
print('='*40,"\n\tcos(x)")
print('='*40)
for i in range(startingValue,endingValue+1,intervalValue):
print("\t",i,"\t->\t%.2f" %cos(i*(pi/180)))#x in degree is converted to redain before calling cos(x) math library function
print()
print('*'*40)
print("\n\n")

#table for tan(x)
print('='*40,"\n\ttan(x)")
print('='*40)
for i in range(startingValue,endingValue+1,intervalValue):
print("\t",i,"\t->\t%.2f" %tan(i*(pi/180)))#x in degree is converted to redain before calling tan(x) math library function
print()
print('*'*40)
print("\n\n")

#table for log(x)
print('='*40,"\n\tlog(x)")
print('='*40)
for i in range(startingValue,endingValue+1,intervalValue):
print("\t",i,"\t->\t%.2f" %log(i))#calculate log(x)
print()
print('*'*40)
print("\n\n")

#table for log10(x)
print('='*40,"\n\tlog10(x)")
print('='*40)
for i in range(startingValue,endingValue+1,intervalValue):
print("\t",i,"\t->\t%.2f" %log10(i))#calculate log10(x)
print()
print('*'*40)
print("\n\n")

#this code is in python 3


Related Solutions

(PYTHON)Your company prints math reference tables for high school and first year college students. You’d like...
(PYTHON)Your company prints math reference tables for high school and first year college students. You’d like to write a flexible program that will display the results for several mathematical functions applied to a range of integers, and the results displayed in a table with a header that includes labels separated by tabs: Num Sqr SqRt Sin Cos Tan Log Log10 === === ==== === === === === ===== Write a Python program that prompts the user for a starting integer,...
A school district developed an after-school math tutoring program for high school students. To assess the...
A school district developed an after-school math tutoring program for high school students. To assess the effectiveness of the program, struggling students were randomly selected into treatment and control groups. A pre-test was given to both groups before the start of the program. A post-test assessing the same skills was given after the end of the program. The study team determined the effectiveness of the program by comparing the average change in pre- and post-test scores between the two groups....
A researcher conducts a study of college students to decide whether they like math classes. They...
A researcher conducts a study of college students to decide whether they like math classes. They get a list of students with land-line phone numbers from their University and call the first 25 students, all of whom are English majors, on the list. They ask those students “Which is the worst class you’ve had on campus – your math class or another class?” 18 out of 25 say math, so the researcher concludes that students choose English majors because they...
School A would like to get more high school students to ride the school bus rather...
School A would like to get more high school students to ride the school bus rather than driving to school each day to reduce traffic congestion around the school. To try to encourage more students to ride the bus, the school decides to raise the daily rate for parking in the school parking lot. Design and describe a study that uses an interrupted time series design to provide evidence as to whether the parking rate increase led to an increase...
School A would like to get more high school students to ride the school bus rather...
School A would like to get more high school students to ride the school bus rather than driving to school each day to reduce traffic congestion around the school. To try to encourage more students to ride the bus, the school decides to raise the daily rate for parking in the school parking lot. 1. Design and describe a study that uses an interrupted time series design to provide evidence as to whether the parking rate increase led to an...
The following data is the math test scores of students graduating from a particular high school....
The following data is the math test scores of students graduating from a particular high school. The government uses these scores to determine if there will be accreditation awarded. In order for this to occur the mean score must be above 780. A sample of students' scores is drawn at random and they take the test. The scores are in the following table and the population is considered a normal distribution. Test at the .01 level. 980 764 798 760...
How do California high school students compare to students nationwide in their college readiness, as measured...
How do California high school students compare to students nationwide in their college readiness, as measured by their SAT scores? The national average scores for the class of 2017 were 533 on Evidence-Based Reading and Writing and 527 on the math portion.† Suppose that 100 California students from the class of 2017 were randomly selected and their SAT scores were recorded in the following table. Evidence-Based Reading and Writing Math Sample Average 529 521 Sample Standard Deviation 96 99 (a)...
How do California high school students compare to students nationwide in their college readiness, as measured...
How do California high school students compare to students nationwide in their college readiness, as measured by their SAT scores? The national average scores for the class of 2017 were 533 on Evidence-Based Reading and Writing and 527 on the math portion.† Suppose that 100 California students from the class of 2017 were randomly selected and their SAT scores were recorded in the following table. Evidence-Based Reading and Writing Math Sample Average 529 522 Sample Standard Deviation 98 99 (a)...
Plagiarism Certification Tests for Undergraduate College Students and Advanced High School Students These tests are intended...
Plagiarism Certification Tests for Undergraduate College Students and Advanced High School Students These tests are intended for undergraduate students in college or those under 18 years of age. Read these directions carefully! The below test includes 10 questions, randomly selected from a large inventory. Most questions will be different each time you take the test, You must answer at least 9 out of 10 questions correctly to receive your Certificate. You have 40 minutes to complete each test, and you...
The scores of students on the SAT college entrance examinations at a certain high school had...
The scores of students on the SAT college entrance examinations at a certain high school had a normal distribution with mean μ=544 and standard deviation σ=29.1. (a) What is the probability that a single student randomly chosen from all those taking the test scores 548 or higher? For parts (b) through (d), consider a simple random sample (SRS) of 35 students who took the test. (b) What are the mean and standard deviation of the sample mean score x¯, of...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT