I am working through some exercises on python and my task is to create a program that can take a number, divide it by 2 if it is an even number. Or it will take the number, multiply it by 3, then add 1. It should ask for an input and afterwards it should wait for another input.
My code looks like this, mind you I am new to all this.
print('Please enter a number:')
def numberCheck(c):
if c % 2 == 0:
print(c // 2)
elif c % 2 == 1:
print(3 * c + 1)
c = int(input())
numberCheck(c)
I want it to print "Please enter a number" only once. but after running I want it to wait for another number. How would I do this?
I tried a for
loop but that uses a range and I don't want to set a range unless there is a way to do it to infinity.