Is there some way to make sure that the raw_input is only non-numeric?
<p>I want to make sure that the user enters the input in the correct format and i do know how to make sure its numeric input but i dont understand how to make sure its not numeric input.</p>

<pre><code>x = raw_input('What is your name? ')
y = raw_input('What is your age? ')
try:
    something_to_make_sure_its_not_numeric(x)
    int(y)
    print "Hello {0}, You look very handsome for someone who is {1}.".format(x, y)
except:
    print('please enter input in correct format')
</code></pre>

<p>y question is that is there some function in python like int() that makes sure that it only has letters.</p>

<p>There is also <code>isdigit()</code> function with <code>string</code> to check whether string is numeric or not. To check whether it is non-numeric, simply use <code>not</code> with the condition</p>

<pre><code>&gt;&gt;&gt; 'xyx'.isdigit()
False
&gt;&gt;&gt; '123'.isdigit()
True

# Now check output with "not"
&gt;&gt;&gt; not 'xyx'.isdigit()
True
&gt;&gt;&gt; not '123'.isdigit()
False
</code></pre>

<p>It will be good idea to create your custom function to achieve this using <code>isdigit()</code></p>

<pre><code>def is_non_numeric(num_str):
    return not num_str.isdigit()

# Example
&gt;&gt;&gt; is_non_numeric('123')
False
&gt;&gt;&gt; is_non_numeric('xyz')
True
</code></pre>

python python-2.7