python 3.4 spirograph error -
from turtle import* math import* def xcord(r,r,p,t): x= (r-r) * cos(t) - (r+p) * cos((r-r)//r*t) def ycord (r,r,p,t): y= (r-r) * sin(t) - (r+p) * sin((r-r)//r*t) def t_iter(r,r,p): t=0 down() goto(xcord(r,r,p,t),ycord(r,r,p,t)) while (t < 2 * pi): t = t+.01 xcord(r,r,p,t) ycord(r,r,p,t) up() return def main(): r=100 r=4 p=int(input("please enter number between 10 , 100: ")) if p < 10 or p > 100: input(" incorrect value of p!") t_iter(r,r,p) input("hit enter close porgram") bye() main()
i error:
traceback (most recent call last): file "c:/users/coscio/desktop/spirals.py", line 31, in <module> main() file "c:/users/coscio/desktop/spirals.py", line 27, in main t_iter(r,r,p) file "c:/users/coscio/desktop/spirals.py", line 13, in t_iter goto(xcord(r,r,p,t),ycord(r,r,p,t)) file "<string>", line 1, in goto file "d:\python\lib\turtle.py", line 1774, in goto self._goto(vec2d(*x)) typeerror: type object argument after * must sequence, not nonetype
from turtle import* math import* def xcord(r,r,p,t): return (r-r) * cos(t) - (r+p) * cos((r-r)//r*t) def ycord (r,r,p,t): return (r-r) * sin(t) - (r+p) * sin((r-r)//r*t) def t_iter(r,r,p): t=0 up() xcord(r,r,p,t) ycord(r,r,p,t) while (t < 2 * pi): t = t+.01 goto(xcord(r,r,p,t),ycord(r,r,p,t)) down() return float(xcord(r,r,p,t)) return float(ycord(r,r,p,t)) def validate(): while true: p=int(input("please enter number between 10 , 100: ")) if p >= 10 or p <= 100: break return p def main(): speed(0) r=100 r=4 p = validate() t_iter(r,r,p) xcord(r,r,p,t_iter(r,r,p)) ycord(r,r,p,t_iter(r,r,p)) input("hit enter close porgram") bye() main()
Comments
Post a Comment