[BangPypers] Beginner Help

anirudh bhat abhat38 at gmail.com
Tue Apr 2 11:21:25 CEST 2013


Hi,
Python is dynamically typed language.You dont initialize variables with
data types as you do it in c.


On Tue, Apr 2, 2013 at 2:46 PM, L Radhakrishna Rao
<satishsagar83 at gmail.com>wrote:

> for w in words:
>      print w, len(w)
>
> this is where w is getting initialized.
>
> Even if you will use 'i' there, output will be same.
>
>
> On Tue, Apr 2, 2013 at 2:43 PM, Manish Reddy
> <manishreddytirumala at gmail.com>wrote:
>
> > w is like a variable for python. You can use any variable instead of w
> and
> > get the same output.
> >
> > Your code is telling python to execute something for each item in the
> list.
> > So, w takes 'cat', 'window', 'defenestrate' each time and executes the
> code
> > for each of them.
> >
> > Hope I helped.
> >
> >
> > On Tue, Apr 2, 2013 at 2:38 PM, Gaurav Malhotra <gaurav.tula at gmail.com
> > >wrote:
> >
> > > Hi everyone,
> > >
> > > Below is the code (with output) which can be found in the Python
> Official
> > > Documentation:
> > >
> > > >>> # Measure some strings:
> > >
> > > ... words = ['cat', 'window', 'defenestrate']
> > >
> > > >>> for w in words:
> > >
> > > ...     print w, len(w)
> > >
> > > ...
> > >
> > > cat 3
> > >
> > > window 6
> > >
> > > defenestrate 12
> > >
> > > # The Problem is:
> > > When "w" is not defined how python interpreter can evaluate the
> output??
> > >
> > > Please Explain the lines where "w" is occurred. if i would replace "w"
> > with
> > > any other variable, it will show the same output.
> > >
> > > I want to know "What is happening in the back (i mean how interpreter
> is
> > > handling it)" ??
> > >
> > > Thanks & Regards,
> > > Gaurav Malhotra
> > >
> > > --
> > > *Regards
> > > Gaurav Malhotra
> > > +91-9410562301*
> > > _______________________________________________
> > > BangPypers mailing list
> > > BangPypers at python.org
> > > http://mail.python.org/mailman/listinfo/bangpypers
> > >
> >
> >
> >
> > --
> > Manish Reddy
> > www.LurnQ.com
> > _______________________________________________
> > BangPypers mailing list
> > BangPypers at python.org
> > http://mail.python.org/mailman/listinfo/bangpypers
> >
> _______________________________________________
> BangPypers mailing list
> BangPypers at python.org
> http://mail.python.org/mailman/listinfo/bangpypers
>


More information about the BangPypers mailing list