Sep-20-2020, 06:23 PM
I have updated the code and added the capability to calculate multiple rings but keep getting a syntaxerror on the last line. Any suggestion welcome.
""" Written by: Dave Taylor Date: September 20, 2020 Python Version 3.8 Program to aid in the design of Segmented wood turnings. SegCalc is designed to create the angle and segment length of a given number of rings at a given diameter starting at the base of the bowl. Output is through a CSV file which if the installation is using Excel will create a printed output. """ import csv file_name = input ("enter the name of the file to be created .txt ") rings = float (input ("enter the number of segment rings")) with open ("c:/user/detay/pycharmprojects/segcalc.csv","w", newline="") as f: datainput = csv.writer (f , delimiter = ",") datainput.writerow (["Ring # ", "Sebments", "angle", "Length"]) while rings >0: seg = float(input ("enter the number of segments ")) dia = float (input ("Enter the diameter of the ring ")) cir = dia * 3.1416 angle = 360/(2*seg) seglen = cir/seg with open ("c:/users/deta/pycharmprojects/segcalc.csv" "a", newline = "") as f: datainput = csv.writer (f , delimiter = ",") datainput.writerow ([rings, seg, angle,seglen]) print ("Rings " + str(rings + "Segments " + str(seg) + "Angle " + str(angle) + "Length" = str(seglen)) rings -=1