Question

Write a Python program that displays row by row cosine value from 0 degrees to 360...

Write a Python program that displays row by row cosine value from 0 degrees to 360 degrees with a step of 15 degree.

Desired output

0 degree = 1.00

15 degree = 0.97

30 degree = 0.87

...

360 degree = 1.00

Homework Answers

Answer #1

CODE

import math

for i in range(0, 361, 15): # looping from 0 to 361 in steps of 15

print(i, "degree =", round(math.cos(math.radians(i)), 2))

OUTPUT

0 degree = 1.0
15 degree = 0.97
30 degree = 0.87
45 degree = 0.71
60 degree = 0.5
75 degree = 0.26
90 degree = 0.0
105 degree = -0.26
120 degree = -0.5
135 degree = -0.71
150 degree = -0.87
165 degree = -0.97
180 degree = -1.0
195 degree = -0.97
210 degree = -0.87
225 degree = -0.71
240 degree = -0.5
255 degree = -0.26
270 degree = -0.0
285 degree = 0.26
300 degree = 0.5
315 degree = 0.71
330 degree = 0.87
345 degree = 0.97
360 degree = 1.0

# Hit the thumbs up if you are fine with the answer. Happy Learning!

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
Write a PYTHON program that displays a weekly payroll report. A loop in the program should...
Write a PYTHON program that displays a weekly payroll report. A loop in the program should ask the user for the employee number, gross pay, state tax, federal tax, and FICA withholdings. The loop will terminate when 0 is entered for the employee number. After the data is entered, the program should display totals for gross pay, state tax, federal tax, FICA withholdings, and net pay. Input Validation: ▪ Do not accept negative numbers for any of the items entered....
Covert the following Java program to a Python program: import java.util.Scanner; /** * Displays the average...
Covert the following Java program to a Python program: import java.util.Scanner; /** * Displays the average of a set of numbers */ public class AverageValue { public static void main(String[] args) { final int SENTINEL = 0; int newValue; int numValues = 0;                         int sumOfValues = 0; double avg; Scanner input = new Scanner(System.in); /* Get a set of numbers from user */ System.out.println("Calculate Average Program"); System.out.print("Enter a value (" + SENTINEL + " to quit): "); newValue =...
Write a program which inputs an integer value, incr, from the user at the keyboard, and...
Write a program which inputs an integer value, incr, from the user at the keyboard, and then displays a graph of the sine of the degree values from 0 to 180, in increments of incr. You must use the sin function (in a similar manner to ceil and floor) to find the sine. Note that the sin function only operates on radians so the degree value must first be converted to radians. To do so, multiply the degree value by...
In Python: Problem 4. Write a program [call it minmax.py] that accepts three integers in the...
In Python: Problem 4. Write a program [call it minmax.py] that accepts three integers in the range [0-100] as input from the user. Your program should then determine and print the smallest and largest integers in the values entered by the user using comparison operators *not* using predefined min or max Python functions. For instance: If the user input is: 36 5 99 your program should give as output: min = 5 max = 99 If the user input is:...
Write a Python program prints out the unique elements of a list lst in a sorted...
Write a Python program prints out the unique elements of a list lst in a sorted manner (i.e it removes duplicates from the list). For example, if list is [10,20,30,20,10,50,60,40,80,50,40], the output should be [10, 20, 30, 40, 50, 60, 80].?
6) Write the Python Code which can answer the following questions (20 pts): a)Consider a program...
6) Write the Python Code which can answer the following questions (20 pts): a)Consider a program which contains a list of numbers from 1 to 10that are stored into a variable a. Create a program that will allow you to exchange the elements from variable a at position 0 and 7from within this list. b)Create a program that will access the last 5 elements of the variable a from step a.)
this is in python 3.6 Write a program that prints to three significant figures the values...
this is in python 3.6 Write a program that prints to three significant figures the values of x and g(x) from x = 0 to x = 10 in increments of 2 units. The values of x include 0 and 10. The function g(x) is defined below: g(x): sqrt(x); x<4    sqrt(4); 4<=x The output of the first and last values are below: 0.000 0.000 ... ... 10.000 2.000
python code Write the function definition for a function which accepts one value from the main...
python code Write the function definition for a function which accepts one value from the main program and prints three times the number that is sent to it. For example, if the program sent 8, the function would print 24.
Write a Python program that reads in the month, day, and year of a date and...
Write a Python program that reads in the month, day, and year of a date and prints it in the dd/mm/yyyy format or mm/dd/yyyy format, the format depending on the user’s preference. The program also prints the message It is a magic date If the product of month and day is equal to the last two digits of the year. For example, April 20 1980 is a magic date because April (numeric value 4) multiplied by 20 is equal to...
Write a Matlab program to plot the cosine wave. That is plot y=cos(k1x) vs. x for...
Write a Matlab program to plot the cosine wave. That is plot y=cos(k1x) vs. x for x varying from 0 to 2pi radians. The value of k1 is given at the end of this document. You can choose the increment for x. Note that large values of the increment will give you a coarse graph. Note: Matlab has two functions to calculate the sine of an angle: sin(x) and sind(x). What is the difference between these two functions? Use help...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT