Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Tip: Python Variables and Typing

DZone's Guide to

Tip: Python Variables and Typing

· Web Dev Zone
Free Resource

Discover how to focus on operators for Reactive Programming and how they are essential to react to data in your application.  Brought to you in partnership with Wakanda

Never forget, Python uses duck typing and has typed objects but untyped variable names.

lfc = "Liverpool" # this is a string
manc = "Manchester City"
l_score = 3 # this is a integer
m_score = 0
print "Result",lfc,l_score,"-",m_score,manc
Result Liverpool 1 - 0 Manchester City

How to know the type of variables:

type(lfc)
<type 'str'="">
type(l_score)
<type 'int'="">

Source:  http://glowingpython.blogspot.com/2011/04/variables-and-typing.html


Learn how divergent branches can appear in your repository and how to better understand why they are called “branches".  Brought to you in partnership with Wakanda

Topics:

Opinions expressed by DZone contributors are their own.

The best of DZone straight to your inbox.

SEE AN EXAMPLE
Please provide a valid email address.

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.
Subscribe

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}