Python Leaning Notes #1
General Internal Functions
- print()
- input(_prompt): return a string and can be stroed in a variable, like name = input(“What is your name? “)
Variable type
- integer: 1, 2, 3, … conver function int(“123”)
- string: “test”, convert function str(123)
- float: 1.121, convert function float(“1.121”)
- boolean: False, True, convert function bool(“123”)
String Manipulation
- using three single quote to handle multiple lines string ”’ ”’
- f” means to format the string, like f'{variable#1} loves {variable#2}’
- using [startLocation:endLocation] to extra the string, this will exclude the endLocation character, like: “abcde”, “abcde”[1:-1] = “bcd”