Changing str to int in Python
Question: I am new to python. I am trying to make a small elavator program.

The code:

    
    
    import time
    elavator = True
    # 0 is B floor // basement
    elavatorFloors = [0,1,2,3,4,5]
    
    while elavator == True:
        getLevel = input ("Which floor would you like to visit? ( 1 - 5) ")
        time.sleep(2)
        print "you're now at floor, " +int.getLevel
    

I get this error: AttributeError: type object 'int' has no attribute
'getLevel' Aside from changing the str to int, am I using any bad technique? I
really want to improve my programming thinking and code writing. Thank you :)


Answer: `int()` is a type, so to instantiate it, you need to do `int(getLevel)`, not
`int.getLevel`.

Check [the docs](http://docs.python.org/3/library/functions.html#int) for
examples and more.

Also note that `getLevel` is an odd name for the variable, as it implies it is
a function that gives the level. A better name would be just `level`.

It's also worth noting that `input()` evaluates the input as Python code (In
Python 2.x, in 3.x it acts as `raw_input()` does in older versions), so
`getLevel` will already be a number, although I would recommend using
`raw_input()` instead, and keeping your conversion from a string to an
integer, as it won't allow arbitrary execution of code, which is much better.

