I wrote a script that works, but when I open it as a .py file email attachment, after I finish answer the inputs and it runs, it closes. What can I do to stop this. Here is the code if it helps:
# Write a program to solve an ancient Chinese puzzle: We count 35 heads
# and 94 legs among the chickens and rabbits on a farm. How many rabbits
# and how many chickens are there?
# Inputs the number of heads and legs, respectively.
# Makes sure it is read as an integer.
h=input('Enter the number of heads:')
heads=int(h)
le=input('Enter the number of legs:')
legs=int(le)
# Executes a while loop while the total number of rabbits is less
# than or equal to 35.
rabbits=0
while rabbits <= heads:
chickens = heads - rabbits
# Prints the result if there are 35 heads and 94 legs found.
if 2 * chickens + 4 * rabbits == legs and chickens + rabbits == heads:
print('There are', rabbits, 'rabbits and', chickens, 'chickens.')
break
rabbits+=1
if 2 * chickens + 4 * rabbits != legs or chickens + rabbits != heads:
print('No answer.')