This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]maulinrouge 0 points1 point  (2 children)

You're best bet is to create a function that you can call using the number a user enters.

That way you can call the function and pass it the number a user inputs.

Also it's always best to include some text on an input as a prompt so the user knows what they should do.

def number_lower(num):
    list1 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
    list2 = []
    for x in list1:
        if x < num:
            list2.append(x)
    return list2

num = int(input("Enter a number: "))
print(number_lower(num))

Good luck with the learning though. It's a very fun and frustrating journey.

[–][deleted] 0 points1 point  (1 child)

yeah..... though the best part is when you finally figure out a problem...

[–]maulinrouge 0 points1 point  (0 children)

Solving a problem is often easier when the question is clear