Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Administrator
/
lesson14_1
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
dbe9bd4c
authored
Nov 16, 2020
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
auto save
parent
7b9a1090
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
41 additions
and
26 deletions
begin.py
hello.py
study.py
test.py
begin.py
deleted
100644 → 0
View file @
7b9a1090
import
turtle
p
=
turtle
.
Pen
()
p
.
fillcolor
(
"red"
)
p
.
shape
(
"turtle"
)
# p.shapesize(10)
p
.
begin_fill
()
for
i
in
range
(
5
):
p
.
forward
(
100
)
p
.
left
(
144
)
p
.
end_fill
()
p
.
hideturtle
()
turtle
.
done
()
\ No newline at end of file
hello.py
deleted
100644 → 0
View file @
7b9a1090
# name = "悟空"
# word = "欢迎你"
# print(name+word)
# a=1
# b=1.0
# c=[1,2,3]
# d="你好"
# print(type(a))
# print(type(b))
# print(type(c))
# print(type(d))
study.py
0 → 100644
View file @
dbe9bd4c
#创建一个类
class
类名():
def
__init__
(
self
):
self
.
变量
1
=
属性
1
self
.
变量
2
=
属性
2
实例化对象
查看对象属性的时候,注意点记法
二:
实例属性
在类里面是实例方法的时候
class
类名():
def
方法名
(
self
,
形参
1
,
形参
2
):
self
.
变量
1
=
形参
1
self
.
变量
2
=
形参
2
实例化对象
:
实例化对象
1
=
类名(实参
1
,实参
2
)
实例化对象
1
=
类名(实参
1
,实参
2
)
查看对象属性的时候,注意点记法
实例属性
class
类名():
def
__init__
(
self
,
形参
1
,
形参
2
):
self
.
变量
1
=
形参
1
self
.
变量
2
=
形参
2
实例化对象
:
实例化对象
1
=
类名(实参
1
,实参
2
)
实例化对象
1
=
类名(实参
1
,实参
2
)
查看对象属性的时候,注意点记法
test.py
0 → 100644
View file @
dbe9bd4c
#创建英雄类
class
Hero
():
def
__init__
(
self
):
self
.
level
=
1
self
.
hp
=
300
self
.
attack
=
20
#实例化英雄亚瑟
yase
=
Hero
()
print
(
yase
.
hp
)
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment