|
print()
|
Show information that you want on the screen
|
|
int()
|
Change number to be number integer
|
|
float()
|
Change number to be decimal number
|
|
input()
|
Gain information from user
|
|
str()
|
A list of number, letter and symbols
|
|
len()
|
The length of the string
|
|
#
|
Comment, no effect
|
|
string + string
|
Combine together
|
|
string + number
|
CRASH!
|
|
number + number
|
Addition (Math)
|
# name: max2
# arguments: num1, num2
# return: the largest value
def max2(num1, num2):
maxvalue = num1
if num2 > num1:
maxvalue = num2
return maxvalue
print(max2(10, 9))
print(max2(1, 9))
# write a function that returns the largest of three values
# name: max3
# arguments: num1, num2, num3
# return: the largest value
def max3(num1, num2, num3):
maxvalue = num1
if num2 > maxvalue:
maxvalue = num2
if num3 > maxvalue:
maxvalue = num3
return maxvalue
print(max3(2, 12, 4))
print(max3(19, 9, 17))
# write a function that returns the largest number in a list
# name: maxlist
# arguments: list
# return the largest value in the list
def maxlist(list):
# loop through the list
return maxvalue
numlist = (1, 2, 3, 4, 5, 99)
print(maxlist(numlist))
|
Variable
|
Hold a value and can be change
|
|
String
|
A list of character such as number, letter and symbols
|
|
Integer number
|
Whole number/counting number
|
|
Floating point
|
The number in decimal
|
|
Syntax
|
Grammar/Structure of lauguage
|
|
Modulo
|
Find the remainder
|
|
Boolean
|
True/False
|
|
string * number
|
Combine that string
|
|
string* string
|
CRASH!
|
|
number * number
|
Multiply (Math)
|
|
string ** string
|
CRASH!
|
|
number ** number
|
Exponent (Math)
|
|
string ** number
|
CRASH!
|
|
==
|
equal to
|
|
!=
|
no equal to
|
|
<
|
less than
|
|
>
|
more than
|
|
<=
|
less than or equal to
|
|
>=
|
more than or equal to
|
|
%
|
Modulo, Find the remainder
|
No comments yet.
Cheatography n. The art of mapping complex subjects into clear, instantly navigable reference guides.