>>>>> Prasoon <prasoonthegr...@gmail.com> (P) wrote:

>P> What is the difference between
>P> z=int(raw_input()) and z=eval(raw_input())????(I thought them to be
>P> the same in case of integers)

>P> I mean when an integer is entered in that case are they same and when
>P> an integer in not entered,in that case how are they different?????

>>> z=eval(raw_input())
3+4
>>> z
7
>>> z=int(raw_input())
3+4
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ValueError: invalid literal for int() with base 10: '3+4'

-- 
Piet van Oostrum <p...@cs.uu.nl>
URL: http://pietvanoostrum.com [PGP 8DAE142BE17999C4]
Private email: p...@vanoostrum.org
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to