Skip to main content

Part of the book series: Textbooks on Political Analysis ((TPA))

  • 1477 Accesses

Abstract

This chapter introduces basic Python concepts that will be used throughout the remainder of this text. If you are already familiar with another programming language, such as R, many of the concepts here will be analogous. If you are approaching Python as your first programming language (and it is a good choice for that purpose), you may benefit from working through this material alongside another introductory text such as Shaw (Learn python the hard way, 2013).

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 54.99
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 69.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info
Hardcover Book
USD 109.99
Price excludes VAT (USA)
  • Durable hardcover edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Notes

  1. 1.

    This is true for Python versions 2.7.9 and after. If you do not have pip installed, see https://pip.pypa.io/en/stable/installing/.

  2. 2.

    Also known as a REPL, which stands for “read, evaluate, print loop.” This describes exactly what happens: the interpreter reads your input, evaluates it, and prints the output.

  3. 3.

    Python 2 used integer division by default, so 17 / 3 would return 5.

  4. 4.

    Unlike some other languages, there is no difference in Python between double-quoted and single-quoted strings. The only requirement is that they match, i.e. "hello" is invalid.

  5. 5.

    Note that if you are using Python 2 instead of 3, the last example above should use person_dictionary.iteritems() instead of person_dictionary.items().

References

  1. Shaw, Z. (2013). Learn python the hard way. Retrieved March 24, 2018, from https://learnpythonthehardway.org/book/

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Rights and permissions

Reprints and permissions

Copyright information

© 2020 Springer Nature Switzerland AG

About this chapter

Check for updates. Verify currency and authenticity via CrossMark

Cite this chapter

Cutler, J., Dickenson, M. (2020). Getting Started with Python. In: Computational Frameworks for Political and Social Research with Python. Textbooks on Political Analysis. Springer, Cham. https://doi.org/10.1007/978-3-030-36826-5_1

Download citation

Publish with us

Policies and ethics