|
print
|
Show information on the screen
|
|
int
|
to tell that what you write is a number
|
|
float
|
change number to be decimal number
|
|
str
|
list of number, letter and symbol
|
|
str+str
|
the result combine together
|
|
str+ int or float
|
crash
|
|
int/float + int/float
|
math - addition
|
|
string*string
|
crash
|
|
string*number
|
combine string together
|
|
number*number
|
math-multiply
|
|
number ** number
|
math-exponent
|
|
string ** string
|
crash
|
|
string**number
|
crash
|
def myprint(text) :
print ('xxx'+str(text)+'xxx')
myprint (1)
def doubleIt (number):
return number *2
print (doubleIt(2))
print (doubleIt('hello'))
myvar = doubleIt(doubleIt(3))
print (myvar)
|
==
|
equal
|
|
!=
|
not equal
|
|
>
|
greater than
|
|
<
|
less than
|
|
>=
|
greater than or equal to
|
|
<=
|
less than or equal to
|
|
variable
|
hold a value and can be change
|
|
string
|
a list of character such as number, letter and symbols
|
|
integer
|
a number without decimal
|
|
float
|
number in dicimal
|
|
syntax
|
structure of language
|
|
value
|
returns a list of all the values available in a given dictionary.
|
|
while
|
it's a loop that will go over and over until you stop it
|
|
loop
|
traditionally used when you have a piece of code which you want to repeat n number of times
|
|
input
|
Run the program. In the Shell you should see
|
|
print
|
to show information on the
|
|
modulo
|
leave remainder
|
|
#
|
Comment, no effect
|
|
randon.choice
|
program that someone wrote
|
|
import random
|
to get get a random program from someone
|
|
import
|
to import program from someone
|
|
import random + random.choice()
|
pick random item in the list
|
|
palindrome
|
is derived from the Greek palíndromos, meaning running back again
|
def bacon():
print ('bacon')
print ('egg')
print ('text')
print ('gta')
print ('guildwar')
print ('magalodon')
return
bacon()
bacon()
No comments yet.
Cheatography n. The art of mapping complex subjects into clear, instantly navigable reference guides.