|
input ( )
|
to write something to ask or tell the user
|
|
print ( )
|
to write out on the screen
|
|
int ( )
|
turn to number to be able to do math or to make the number to integer.
|
|
float ( )
|
turn the number into decimal point
|
|
str( )
|
a list of things
|
|
len ( )
|
the length of the word
|
|
If Statement
|
|
if :
|
|
elif :
|
|
else:
|
|
While Loop
|
|
while :
|
|
For Loop
|
|
for var in list:
|
|
Counting For Loop
|
|
for i in range(1,101 ): 1-100
|
|
import random
|
|
|
list = ['a', 'b', 'c', 'd', 'e']
|
|
|
chance = 3
|
|
|
score = 0
|
|
|
print (list)
|
|
|
while chance != 0:
|
|
|
random_item = random.choice(list)
|
|
|
user = input("guess a word ")
|
|
|
if user== random_item:
|
|
def areatriangle(base,height):
|
|
|
area = (base*height)/2
|
|
|
return area
|
|
==
|
equal to
|
|
!=
|
not equal
|
|
<
|
less than
|
|
>
|
more than
|
|
<=
|
less than or equal to
|
|
>=
|
more than or equal to
|
|
+
|
combine / plus
|
|
-
|
minus
|
|
/
|
division
|
|
*
|
multiplication
|
|
**
|
power
|
|
%
|
remainder
|
|
H
|
|
|
e
|
|
|
l
|
|
|
l
|
|
|
o
|
|
ask
|
=input("Write down two number and an operation in a form of.... main(?,?,?) , example: main(2,3,sum), start a new line")
|
|
def sum(a,b):
|
|
|
return a+b
|
|
|
def diff(a,b):
|
|
|
return a-b
|
|
|
def mult(a,b):
|
|
|
return a*b
|
|
|
def div(a,b):
|
|
|
return a/b
|
|
|
variable
|
a value and can be change
|
|
string
|
a list of character such as number, letter and symbols
|
|
integer
|
whole number or counting number
|
|
float
|
decimal number
|
|
syntax
|
grammar or structure of lauguage
|
|
value
|
returns a list of all the values available in a given dictionary.
|
|
loop
|
going over and over again repeating
|
|
modulo
|
remainder
|
|
Boolean
|
truth or false
|
|
import random
|
include the random program
|
|
random.choice( )
|
pick a random item on your list
|
|
while True:
|
|
|
word = input("Enter a word")
|
|
|
if word == "quit":
|
|
|
break
|
|
|
print ("The lenght of the word is",len(word))
|
|
|
reverse=''
|
No comments yet.
Cheatography n. The art of mapping complex subjects into clear, instantly navigable reference guides.