CMSC - Lecture 2

¡Supera tus tareas y exámenes ahora con Quizwiz!

Whar are some numeric operators?

+ addition - subtraction * multipication / float division // integer division ** exponent % remainder

What are the augmented assignment operators?

+= addition assignment -= subtraction *= multipication /= float division //= integer division %= remainder division **= exponent division

What are the 3 rules in binary addition?

0 + 0 = 0 1 + 0 or 0 + 1 = 1 1 + 1 = 10

How is scientific notation written?

1.23456e+2 is the same as 1.23456e2, which is equivalent to 123.456

How many numbers can be represented with 2 bits?

4

What is the input function?

A function that collects key strokes from the console

What is a function?

A group of statements that performs a specific task

What is a variable?

A named piece of data that stores a value. Used to reference values that may be changed in the program It has a type that defines how the memory is interpreted and what operations are allowed

What is a simultaneous assignment?

Allows a shorthand to create/assign multiple variables at a time.

What does the int function do?

Converts any data type to an integer

Decimal to Hexademical?

Do the same except you divide by 16. Use decimal number 189 Step 1: 189/16 = 11 r 13 (D) Step 2: 11/16 = 0 R 11 (B) dont forget..bottom up approach

What are assignment statements?

Gives values to a variable

What are identifiers?

Names that identify the elements such as variables and functions in a program can consist of letters, digits, underscores and asterisks must start with a letter or underscore cannot be a reserved word an identifier can be any length

How do you convert decimals to binary?

Repeated division by 2 to convert numbers from decimal to binary Example: convert 15sub10 to a binary Step 1: 15/2 = 7 R 1 Step 2: 7/2 = 3 R 1 Step 3 = 3/2 = 1 R 1 Step 4: 1/2 = 0 R 1 So, the binary is 1111 sub 2

What is memory?

Storage for data and programs Each cell as an address .. a location and a value in the computer these values are represented in binary and addresses are located in hexadecimal

What are the three types of data types?

Strings - sequences of characters Floating point numbers - representing real numbers with fractional components Integers = representing positive and negative whole numbers

What are named constants?

Values that never change You can create a variable to denote a constat. Use all uppercase letters

What is underflow?

When a floating-point number is too small to be stored. It approximates to zero should not worry about underflow

What is an overflow?

When a floating-point variable is assigned a value that is too large, it casues overflow

A 64 bit number can represent values from... to ....

[-2^64, 2^64]

What is a literal?

a constant value that appears directly in the program.

How are integers reprsented in binary ?

binary numbers work the same way in base 2. Example: 0010 0101 You start off all the way to the right and do base^0 x 1 That gets added to base^1 x 0 that gets added to base^2 x 1 that gets added to base^3 x 0 It continues until the whole binary code is done

what is camel casing?

capitalize the first letter of each subsequent word

What are expressions?

combinations of literals, variables, operations, and functions that generate new values

What does the float function do?

converts a data type to a float value

What does str function do

converts the data type to a string

What is the eval function?

converts these key strokes from the input equation to a value

What are the steps of tracing:

memory output

What is snake casing?

names with underscores separating words

What are some other common number systems?

octal (base 8, digits 0-7) hexadecimal (base 16, digits 0-9 and A-F)

What are some examples of functions in python?

print eval input int

What does round do?

round will round the float value to the nearest integer

what does the print function do?

the print function can output a series of values separated by a comment


Conjuntos de estudio relacionados

Chapter Understanding Health and Wellness Lesson 3 Health Risks and Your Behavior

View Set

ER* Prep-U: Chapter 47: Management of Patients With Intestinal and Rectal Disorders

View Set

AWS Certified Cloud Practitioner Practice Exams 2

View Set

Pain Threshold and Pain tolerance

View Set

Midterm Guide (Windows 10,Microsoft and Excel)

View Set

Med Surg Question Collection renal

View Set