Week 1
Str(“word”), int(number), boolean: True/False, tps: str and int cannot just put tgt
Print (“”): print something for user to read, can print multiple things (name, age), always return in str, can be use to debug and not save.  Can use type() to check is str or int
range(): sequence of numbers
+-*/  //means dividend by int, >=, <=, =, ==, !=, \n Newline
If x: use in condition check, elif x: use in otherwise condition, else: execute when the conditions are not met. Be careful about the up-to-down order, and it will return to True or False, or what been set for
and means the two variable all should be true, or means one of the var should be true, not means without this condition/var.
Week 2
In: to check does something exist and included.
String punction, punction and space also string
len(): to count the string, can used to check the length of the password
Function&Method: function is the function outside like len() print(), method is belonging to the object itself like text.count(“a”)
Method:
.count(“”) calculate the frequency of occurrence of a certain character/word
“text”. replace(“old”,”new”) or text = text.replace(“old”,”new”): replace string, text.replace is wrong as string is immutable.
.upper + .lower
. startswith(“text”): check the beginning, will return to True or False
Obfuscation: hide the actual password for the user
hide = “*” * len(password)
while loops: is circulation, if the condition is True will keep repeating, easy to get endless loop
for loops: is traversal, it will read through all the terms. Know the range, Saver to use
Function is def topic(term1, term2): code. Parameters are temporary variable, such as term1 and term2
return is send the value "back", is for code not human, assignable, direct after return the code not run.
Week 3 LIST&DICTIONARIES
List = [ ] : for storage: "multiple values", can use list() to check.
Index: python start with 0
.append(): add elements at the end
Dictionaries = { }: Key-value structure. .keys() and .values()
Complex data structure: dict inside list:
topic = [{“name” : “sim”, “age” : 20}]
None often comes from can’t find .get(“”)/function not return
Week 4 HTML&PYTHML
Browser (Google) only reads HTML/CSS/JS; server runs Python, create HTML, and returns it to the browser to create a web page.
Flask run on the server, it is Python web framework, can let python make the web. It must be return, or the page will boom.
“/” home page
HTML is a web page language.
Must include <html><body>
<h1> Title <p> paragraph <img> image <form> <a>link <ol> order list <ul>Unordered List <li> List item <table> <tr>Table Row <td>Table Data
Pyhtml used in from p.html() if want to return in pyhtml from it have to be written in str(), as browser need str to read.
Libraries: code written by others, have to import
datetime: have to import, used to count date, date!=datetime. today = datetime.date.today()
Week 5 Cookies& JSON
Cookies: session in flask, can store one user data, such as search history, need app.config['SECRET_KEY'] =’ anything secret’ remember use session.modified = True to tell flask it has changed.
Serialisation: save all user data in file from JSON, nomal cookies might lost data when server restart, saver
create_if_not_exist("name.json", {})
text = “”
write_json_file("name.json", text)
names = read_json_file("name.json")
Week 8  CSS
selector {what wants to change: change to what;}
put in pyhtml before the body. p.head(p.title(“the title”),
p.link(rel="stylesheet",href="/static/style.css")),
Common CSS Properties
background-color: blue;
font-family: Arial(Bodoni 72);
font-size: 20px;
text-align: center;
div is a box help to control
.container {
  display: grid;
  grid-template-columns: auto auto auto;
  background-color: dodgerblue;
  padding: 10px;}
Use p.div(class_="container")(p.div(class_="header")(p.p("")),) to link css with def content in server
