Python Lottery number and checker
Question: I am attempting to create a random number generator for any number of numbers
in a line and then repeating those random numbers until a "target" number is
reached. The user will enter both the number of numbers in the sequence and
the sequence they are shooting for. The program will run the random numbers
over and over until the target sequence is hit, then the program will spit out
the number of repetitions it took. My problem is that it keeps going on
forever, seemingly never hitting the break function because num doesn't equal
target or something. So far I have this and i think i am pretty close

    
    
    #Module to get amount of numbers in the sequence 
    def getRange():
        Range =int(input("How many digits in your number?"))
        return Range
    #Target Sequence input
    def getTarget():
        Target= []
        Target =input("What is your target sequence?")
    
        return Target
    
    def lotteryNo(Range):
        import random
        integer = []
    
        for number in range(0 , Range):
            integer.append(random.randint(0, 9))  
        return integer
    
    def printDigits(Range,Target):
    
        print("Your target list is",Target) 
        for rep in range(10000000):
            num=(lotteryNo(Range))
            print(num) 
            if num == Target:
                rep=rep + 1
                print("The number of repetitions is",rep) 
                break
    
    
            else:
                rep=rep+1 
    
    
    
    def main():
        Range=getRange()
        Target=getTarget() 
        printDigits(Range,Target)
    main()
    #End
    


Answer: The issue with your comparison is that you're testing `Target` which is a
string against `num` which is a list of integers. That will never match, no
matter what integers and what string you're dealing with. You need to compare
two like-types to get a meaningful result.

It looks like you wanted your `getTarget` function to return a list, since
you're initializing `Target` to an empty string. However, when you overwrite
it with `Target = input(...)`, the list is discarded.

You probably want something like `Target = list(map(int, input()))`, which
converts each character of the input string to an integer and then packs them
all into a list. Another way of writing that would be `Target = [int(digit)
for digit in input()]`.

One further suggestion, unrelated to your current issue: Python's common
naming convention is to use `lower_case_names_with_underscores` for variable
and function names, reserving `UpperCaseNames` for classes. You don't have to
follow this convention, but it's probably a good idea if you're going to share
your code with anyone. You can read [PEP
8](https://www.python.org/dev/peps/pep-0008/) for more style suggestions.

