def p_parameter(p):
if p < 10 or p > 100:
int(input("Please try again: "))
newp = p
return newp
else:
newp <10 or newp >100
input("Good bye")
bye()
def main():
speed(0)
R=100
r=4
p=int(input("Please enter a number between 10 and 100: "))
p_parameter(p)
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 to close porgram")
bye()
main()
Here is my code for a program which draws a spirograph. The program runs fine but what I have posted here is my attempt to have the user enter a value between 10-100 for p
.
What I want to do is check to see if p
is < 10 or p
> 100. If it is, then give the user a chance to re-enter a new value of p
and use that value as long as it fits the allowed limits. After the second check if the user still has entered an incorrect value of p
I want the program to close.
The problem is that it checks for 'p' then asks for p
again but it only take the first value of 'p', and does not preform the second check or give p
its new value.