Chapter 2 - Types, variables and simple I/O Flashcards
American Standard Code for Information exchange
ASCII
newline sequence
\n
tab sequence
\t
print a backslash
\
escape sequence (rings a bell if played by windows)
\a
concatenating strings
combination of strings using “+”
print(“me” + “plus” + “you”)
meplusyou
line continuation (entered at the end of a line); used for readibility
-used outside of a string
print(“Me” \
“ good”) -> Me good
\
peanut butter sandwich
peanut butter sandwich
print((“peanut” + “butter” + “sandwich”) * 2)
a whole number
integer
a number with a fractional point
floating-point number(float)
a sequence of values joined by operators
expression
integer division
19/5 = 3
\
Modulus - produces remainder of an integer
19/5 = 4
%
name = “Momchil”
assignment statement (creates a variable assigns value to variable) ! a variable gets a value, is not assigned one
Name 2 variable rules
- The variable name can only contain numbers, letters and underscores
- Can not start with a number