Skip to content
Snippets Groups Projects
Commit 386c74aa authored by cprutean's avatar cprutean
Browse files

Replace RangeLooptoList.ipynb

parent 10df51e6
No related branches found
No related tags found
No related merge requests found
%% Cell type:markdown id:d6f58633 tags:
# Reading and Printing Floats Main
# Range Loop to List
%% Cell type:code id:c2f2695d tags:
``` python
"""
Starter Python programm to read in and print a floating point number
Example to demonstrate a range loop to write theta and cos theta
to a list
"""
import math
def main():
""" Read in a number and print it
"""
x = float(input("Type in a floating point number : "))
# Print it out
print("The number types was : " + str(x))
n_point = 50
theta_data = [] # empty list
cos_data = [] # empty list
for i in range(0,n_point):
theta = 2.0*math.pi*i/n_point # Set theta
cos = math.cos(theta)
theta_data.append(theta) # Add values to list
cos_data.append(cos)
# Do a default print (not very tidy output, replace this and
# a loop and make it nicer)
print(str(theta_data))
print(str(cos_data))
main()
```
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment