0

I am trying to do a program that will do this

if the number <1000 multpily the number with 2 until its bigger than 1000

if the number >1000 multiply the number with 3 infinitely

x = input("the number")
while True:

    if int(x) <1000:
        x *= 2
        print(int(x))

    if int(x) >1000:
        x *= 3
        print(int(x))

but it only writes the number infinte times. Doesnt multiply it

i hope you understood my problem

1 Answers1

0

x is not an integer, but can be duck typed as one! Check it out:

x = int(input("the number\n"))
print(str(x) + '\n')

while True:

    if x < 1000:
        x *= 2
        print(str(x) + '\n')

    if int(x) > 1000:
        break # my console prints too fast and starts deleting the first rows before I can stop the program
Reedinationer
  • 5,661
  • 1
  • 12
  • 33