Skip to main content

Using Python as a Calculator

  • Chapter
  • First Online:
An Introduction to Python and Computer Programming

Part of the book series: Lecture Notes in Electrical Engineering ((LNEE,volume 353))

  • 14k Accesses

Abstract

This chapter introduces expressions, literals, operators, identifiers, binding and module importing, by illustrating how Python can be used as a calculator. Three mathematical modules, including math, cmath and random, are introduced, which enable more mathematical calculations than built-in operators.

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 99.00
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 129.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info
Hardcover Book
USD 179.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.

    The content after the # symbols are comments and can be ignored when typing the examples. Details about comments are given in Chap. 3 or the rest of the book \(>>>\) indicates an IDLE command.

  2. 2.

    The memory addresses in the examples below are unlikely to be reproduced when the examples are tried again, since the allocation of memory addresses is dynamic and runtime dependent.

  3. 3.

    Exactly which small values are represented as frequently accessed objects depends on the Python distribution.

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Yue Zhang .

Rights and permissions

Reprints and permissions

Copyright information

© 2015 Springer Science+Business Media Singapore

About this chapter

Cite this chapter

Zhang, Y. (2015). Using Python as a Calculator. In: An Introduction to Python and Computer Programming. Lecture Notes in Electrical Engineering, vol 353. Springer, Singapore. https://doi.org/10.1007/978-981-287-609-6_2

Download citation

  • DOI: https://doi.org/10.1007/978-981-287-609-6_2

  • Published:

  • Publisher Name: Springer, Singapore

  • Print ISBN: 978-981-287-608-9

  • Online ISBN: 978-981-287-609-6

  • eBook Packages: EngineeringEngineering (R0)

Publish with us

Policies and ethics