Priscilla Joly - 3iS school
python3 --version
#Python 3.10.8Docstring : Apprendre Python de A à Z (YouTube - 7h)
python3 fileName.pyCreate a Hangman's game !
- Print and prompt
- Generate a random number
- Select a random word in array
- Create and use functions
- Create and use variables
- Work with : string and array
- Array loop (while, for)
- Condition (if, else if, else)
- Import libraries
- Equals: a == b
- Not Equals: a != b
- Less than: a < b
- Less than or equal to: a <= b
- Greater than: a > b
- Greater than or equal to: a >= b
Print text with print() :
print("Hello World !") # Hello World !Prompt in terminal with input() :
response=input("What's your name ?") # Priscillaprint(response) # Priscillaname="Priscilla"print(f"Bonjour {name}") # Bonjour PriscillaGet length of an array with len() :
array= [1]
item=1size=len(array)
print(size) # 1Add item in an array with .append() :
array= []
item=1array.append(item)
print(array) # [1]Remove item in an array at index .pop() :
array= [1, 2, 3]
array.pop(1)
print(array) # [1, 3]Create a condition (if, else if and else) Compare strings
string='STOP'ifstring=="STOP"orstring=="stop" :
# Do somethingifstring=="STOP"andstring=="stop":
# Do somethingelifstring=="toto":
# Do somethingelse :
# Do somethingCompare two numbers
nombre_a=0nombre_b=2ifnombre_a!=nombre_b:
print("nombre_a et nombre_b sont différents")Compare a true/false condition
win=Falseifnotwin:
print("Not a winner")
else:
print("A winner")Create a loop
You can find my Python training on Excercism
# Build in local
docker build -f Dockerfile . -t test# Build and deploy in GCP
docker build . -t eu.gcr.io/deploy-276111/equideow_script:latest
docker push eu.gcr.io/deploy-276111/equideow_script:latest