Trying to get input of two numbers between 0-9

def makepattern(b3n9):
    for b3n9 in make_pattern():
     while True:
         num1 = input("enter number ")
         num2 = input("enter number ")
         num1 = float(num1)
         num2 = float(num2)
         if num1 and num2 in range(0,9):
             break
         makepattern = b3n9 in range(num1, num2)
     print(num1)
     print(num2)
     print(b3n9)
def main():
    print(makepattern)

Hi,
Lots of errors here.

First:

if num1 and num2 in range(0,9):

Is probably not what you want. As it does NOT check if num1 is in range. Try:

if num1 in range(0,9) and num2 in range(0,9):

Furthermore you break when num’s are in range, that’s also probably not what you want, so probably:

if num1 not in range(0,9) and num2 not in range(0,9):

Second using makepattern as function name and as variable name is frowned upon.

Third in main you print something. You might want the see a pattern but you will see something like <function makepattern at …>.

Fourth: you never call the function so it won’t even be executed. Replace the last line with:

makepattern()

1 Like

Thank you sir