-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
基础 #1
Labels
documentation
Improvements or additions to documentation
Comments
数据类型变量 Variable
布尔 BoolTrue or False
数字 Number
字符串 String
列表 List[]
直接赋值 & 浅拷贝(copy) & 深拷贝(deepcopy)
其他函数
元组 Tuple()不可修改 字典 Dictionary{:}
集合 Set{}唯一性
|
if-elif-else 条件判断
while 循环
for 循环
range
|
高级特性 |
Repository owner
locked as off-topic and limited conversation to collaborators
Jan 7, 2021
类 class面对对象编程(Object-Oriented Programming):
class:
# car.py
class Car:
# brand, model, year
def __init__(self, brand):
self.brand = brand
self.model = 'xxx'
self.year = 0
def set_model(self, model):
self.model = model
def set_year(self, year):
self.year = year
def get_info(self):
print(f"Brand: {self.brand}, Model: {self.model}, Year: {self.year}") # main.py
from car import Car
new_car = Car("Subaru")
new_car.set_model("WRX")
new_car.set_year(2014)
new_car.get_info() |
代码规范
|
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
程序 = 数据结构 + 算法
name = input("I'm Ross, What's your name?")
print(f"Hi, {name}. Let's start coding!")
The text was updated successfully, but these errors were encountered: