One thing first, and has higher precedence than or. A or B and C is same as A or (B and C). Keep that in mind when combining the two.
In Python, pretty much like in C, firstTwo == 51 or 52 or 53 or 54 or 55 is interpreted as (firstTwo == 51) or (52) or (53) or (54) or (55), five expressions combined with or. As all but the first (which may or may not) are ...
Unlike C, / will perform true floating point division in Python. To get integer division (and discard the remainder), use // instead.
Regarding being stuck in the for loop, range(num) will loop all the way up to the actual value of num (over four quadrillion iterations for a typical VISA!). Perhaps try something like:
while num > 0:
One small note: sum ...
Python 3 separated integer division // and floating point division / operators. You probably want to use the former (note that it truncates the result, so you might have to use (length + 1) // 2 for rounding up). Oh, and there's //= operator, too.
Something about the nested loops makes me feel uncomfortable. I don't understand them, or why one would want ...
Check this simple program, and see what happens when you get a float from the user using get_float() and then cast it to str. See what is wrong with it and how your program fails?
x = cs50.get_float("Number: ")
if __name__ == "__main__":
Also, your program is full of "...