Book Image

Python for Finance

By : Yuxing Yan
Book Image

Python for Finance

By: Yuxing Yan

Overview of this book

Table of Contents (20 chapters)
Python for Finance
Credits
About the Author
Acknowledgments
About the Reviewers
www.PacktPub.com
Preface
Index

Chapter 2. Using Python as an Ordinary Calculator

In this chapter, we will learn some basic concepts and several frequently used built-in functions of Python, such as basic assignment, precision, addition, subtraction, division, power function, and square root function. In short, we demonstrate how to use Python as an ordinary calculator to solve many finance-related problems.

In this chapter, we will cover the following topics:

  • Assigning values to variables

  • Displaying the value of a variable

  • Exploring error messages

  • Understanding why we can't call a variable without assignment

  • Choosing meaningful variable names

  • Using dir() to find variables and functions

  • Deleting or unsigning a variable

  • Learning basic math operations—addition, subtraction, multiplication, and division

  • Learning about the power function, floor, and remainder

  • Choosing appropriate precision

  • Finding out more information about a specific built-in function

  • Importing the math module

  • The pi, e, log, and exponential functions

  • Distinguishing between...