Skip to main content

Mathematical Problems

  • Chapter
  • First Online:
Python Challenges
  • 3499 Accesses

Abstract

In this chapter, you start learning some basics about a few mathematical operations, including prime numbers and the Roman numeral system. Additionally, I present a couple of ideas for number games. The chapter is rounded off by a short introduction to lambdas. With all this knowledge, you should be well prepared for the exercises.

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

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Notes

  1. 1.

    List comprehension is the term used to describe an expression that generates a new result list based on a sequence of values and a calculation rule (see subsection 5.1.2).

  2. 2.

    As an optimization, you actually only have to calculate up to the root. I briefly discuss this in the following practical tip “Possible optimizations.”

  3. 3.

    Interestingly the value 0 does not exist in Roman numerals.

  4. 4.

    For syntactically invalid Roman numbers, such as IXD, an incorrect result, here 489, can be computed by applying subtraction rule twice in a row: 0 1 10 + 500.

  5. 5.

    For syntactically invalid Roman numbers, such as IXD, an incorrect result, here 489, can be computed by applying subtraction rule twice in a row: 0 1 10 + 500.

Author information

Authors and Affiliations

Authors

Rights and permissions

Reprints and permissions

Copyright information

© 2022 The Author(s), under exclusive license to APress Media, LLC, part of Springer Nature

About this chapter

Check for updates. Verify currency and authenticity via CrossMark

Cite this chapter

Inden, M. (2022). Mathematical Problems. In: Python Challenges. Apress, Berkeley, CA. https://doi.org/10.1007/978-1-4842-7398-2_2

Download citation

Publish with us

Policies and ethics