Data Types and Variable Operators - Lesson 2 Mod 12

Ace your homework & exams now with Quizwiz!

Character

Python provides the chr() function to see which of these is associated with a particular code. Ex: >>> chr(65) 'A'

Unbounded

A mathematical term for functions and values that have no maximum value.

Ordinal

A programmer can find the code behind a character by using the ord() function. Ex: >>> ord('A') 65

Chained Assignment

A quirk of this right-handedness in Python is tha ta programmer can use this to assign multiple variables to the same value at one time. Ex: x = y = z = 2 This results in three separate variables x, y and z referring to the value 2.

String

A sequence of character (upper/lowercase alphabetical characters, numbers, special characters) surrounded by quotes. Python recognizes this as str.

Initialization

A variable in Python must be both declared (that is, have a name assigned) and initialized (that is, ave a value assigned) at the time of creation.

Multiple Assignment

Another quirk of Python syntax is that multiple variables can be assigned to multiple values in the same statement. Ex. x, y, z = 1, 2, 3 This results in three variables like the previous example, however x refers to 1, y refers to 2, and z refers to 3.

NoneType

Can be represented using the None keyword. Similar to null in other languages. It means nothing and will evaluate to False in a conditional statement. Often used to check the result of some action or to ensure a variable has a value and is not nothing.

Character Encoding

Characters and symbols all have unicode behind them, which is how computer see them.

Integer

Defined as type int. Any whole number with no decimal or fractional value. Python3 doesn't limit the max value of these, making it unbounded. The size is limited to the size of the registers/memory allocated to this within the OS.

Literal String Values

May be enclosed by a single ' ' or double " ". May also be prefixed with a letter r or R.

bool

Named after Boolean values, meaning it can hold the values 0 or 1. 0=False 1=True (True and False MUST be capitalized)

Floating Point

Numbers with decimal points and places. Their precision is dependent on the system architecture.

Precision

Refers to the accuracy at which small numbers can be measured. The greater this is, the more decimal places can be represented by a value.

id()

Returns a unique identifier of an object that is referenced by a particular variable

type()

Returns the data type of the object that is referenced by a particular variable

Augmented Assignment

The right-handedness of a Python assignment statement also gives a programmer another shortcut. Often programmers need to perform a calculation on a value and refer to the new value with the same variable name. A counter in a game is a typical example.

Complex

This Python function is used to convert numbers or strings into a complicated number. This method takes two optional parameters and returns one of these numbers. The first parameter is called a real and the second as imaginary parts.

Order of Operations

Use the parenthesis to manually set priority for mathematical operations. .PE[MD][AS] Parenthesis, Exponents, Multiplication/Div, Add/Sub


Related study sets

Letter from Birmingham Jail Allusions/Footnotes (AP EL/C)

View Set

Prime Minister Narendra Modi and the 2014 elections

View Set

MAN 3600 Exam 1 Mini Quiz Questions

View Set

Introduction to Statistics Section 1.1

View Set

BIO 10 Chapter 3 (The Cell: The Fundamental Unit of Life) Review Q's

View Set

Endometrial and myometrial pathology (Pathoma + mahmoud)

View Set