Skip to content

Summary

Summary

In this chapter, you learned how to use the Python REPL, also called the Python prompt, to solve problems. You learned how to do arithmetic, powers and logarithms, trigonometry and save values to variables. Operations on strings were introduced including concatenation and comparison. In the last section of the chapter, Python's print() function was introduced.

Key Terms and Concepts

REPL

Python REPL

Python Prompt

prompt

Python Interpreter

interpreter

operator

mathematical operator

import

module

Python Standard Library

Standard Library

syntax

functions

command line

error

variable

assignment operator

comparison operator

concatenate

equivalent

index

indexing

slicing

Summary of Python Functions and Commands

Below is a summary of the functions and operators used in this chapter:

Arithmetic

Arithmetic Operator Description
+ addition
- subtraction
* multiplication
/ division
** exponents
_ answer in memory

Trigonometry

Trig Function Description
from math import *
sin sine of angle in radians
cos cosine of angle in radians
tan tangent of angle in radians
pi \pi
degrees convert radians to degrees
radians convert degrees to radians
asin inverse sine
acos inverse cosine
atan inverse tangent

Logarithms and Exponents

Logarithms and Exponent Function Description
from math import *
log log base e, natural log
log10 log base 10
exp e^{power}
e the math constant e
pow(x,y) x raised to the y power
sqrt square root

Statistics

Statistics Function Description
from statistics import *
mean mean (average)
median median (middle value)
mode mode (most often)
stdev standard deviation of a sample
pstdev standard deviation of a population