Chapter 5 Python: Numerical Types

Ace your homework & exams now with Quizwiz!

Difference between .trunc and .floor

.trunc will only truncate the float but .floor will round the float down

Booleans

True or False types

str output

User-friendly Output

Correct way of creating a complex number

Using the "complex()" function

Correct way of converting literals (Hexa into binary, etc...)

Using the prefix of the number system. Hex, Oct, and Bin

Three types of division

classic, true, and floor

How does the python interpreter convert different types within one expression

converts the less simplistic type into the more complex type, an int and a floats sum would be a float type

true our false? A variable must be declared before hand

false, variables are declared when given a value

Hexidecimal

A base-16 number system that uses sixteen distinct symbols 0-9 and A-F to represent numbers from 0 to 15.

Fractional

A type containing a numerator and Denominator. Fraction (1, 3)

Fixed Precision

A type containing decimals after the whole number. 1.000345, 1.05

floating point

A type that represents numbers with fractional parts. 3.4141, 4.5678

Complex Numbers

All numbers, a combination of a real and an imaginary numbers. a + 3i

Integer

All whole numbers (both positive and negative) and zero.

Expression Operators

Any simple used in coding to add, subtract, multiply, divide, etc....

repr output

As-code output

Decimal

Base 10 number system

Sets

Collections of objects with numeric operations

Built in functions and modules

Functions such as round, math, and random. All are imported

mathematical functions

Functions, such as the square root and rounding functions that manipulate quantitative data

Utility Modules

Modules such as "math, random" that broaden the tool set available in python

Binary

The binary number system is base 2, using only bits 0 and 1.

Octal

The octal number system is base 8, starting with 0o and followed by using only digits 0 through 7.

Mixed Operation instance (4 * 5 + 6 / 5)

The python interpreter uses precedence within the code to determine what happens first, follows basic math rules (PEMDAS)

True or False? Parentheses will override the precedence rule in the interpreter

true

True or false? you are allowed to mix numerical types within expressions

true


Related study sets

Psych - Ch. 4 Nature & Nurture - Prep: Learning Curve

View Set

TX - Chapter 5: Political Parties, EXAM 3 MINTAP QUIZES

View Set

Ch. 13 lecture spinal cord and spinal nerves

View Set

Chapter 17: Integrated Marketing Communications

View Set

Business Law and Ethics Final LEB 320F

View Set

The More You Know, The Smarter You Are

View Set

HESI Basic Division (whole numbers)

View Set

Life and Health - Chapter 14 North Carolina State Law Quiz

View Set