Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
bellcode
/
lesson10-2
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
99ed4e78
authored
Apr 30, 2022
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
auto save
parent
cc00a9de
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
62 additions
and
10 deletions
diy3.py
diy4.py
diy6.py
quiz.py
v高房.py
diy3.py
0 → 100644
View file @
99ed4e78
filel1
=
open
(
r'c:\Users\bellcode\Desktop\myfile2.txt'
,
'w'
,
encoding
=
'gb2312'
)
filel1
.
write
(
'guyhgj:12'
)
filel1
.
close
()
\ No newline at end of file
diy4.py
0 → 100644
View file @
99ed4e78
str
=
input
(
"输入仨条边"
)
num
=
eval
(
str
)
c
=
list
(
sums
)
c
.
sort
()
print
(
c
)
if
c
[
0
]
+
c
[
1
]
+
c
[
2
]:
print
(
"长{}{}{}能行"
.
format
(
c
[
0
]
,
c
[
1
]
,
c
[
2
]))
if
c
[
0
]
**
2
+
c
[
1
]
**
2
==
c
[
2
]
**
2
:
print
(
'是直角三角形'
)
elif
c
[
0
]
==
c
[
1
]
or
c
[
1
]
==
c
[
2
]:
print
(
'是直角三角形'
)
else
:
print
(
"不能"
)
\ No newline at end of file
diy6.py
0 → 100644
View file @
99ed4e78
str
=
input
(
"请输入两个正整数(以逗号分隔)分别作为分数的分子和分母:"
)
nums
=
eval
(
str
)
a
=
nums
[
0
]
b
=
nums
[
1
]
print
(
"{}/{}"
.
format
(
a
,
b
))
if
a
>
b
:
n
=
b
else
:
n
=
a
for
i
in
range
(
2
,
n
+
1
):
if
a
%
i
==
0
and
b
%
1
==
0
:
a
=
a
//
i
b
=
b
//
i
if
b
==
1
:
print
(
a
)
elif
b
%
aq
==
0
:
b
=
b
//
a
print
(
"1/{}"
.
format
(
a
,
b
))
else
:
print
(
"{}/{}"
.
format
(
a
,
b
))
\ No newline at end of file
quiz.py
View file @
99ed4e78
# 勇于挑战的创造师,下面的代码犯了三类典型错误,请你把bug揪出来吧。 area
area
=
[
"盘丝洞"
,
"白骨洞"
,
"大雁塔"
]
area
=
{
"盘丝洞"
:
"蜘蛛精"
,
"白骨洞"
:
"白骨精"
,
"大雁塔"
:
"花妖"
}
# 打印出悟空语文成绩
print
(
area
[
2
])
# 打印出悟空的美术成绩
monster
[
"地府"
]
=
"僵尸"
# 打印出悟空英语成绩:
print
(
monster
)
\ No newline at end of file
import
turtle
pen
=
turtle
.
Pen
()
pen
.
hideturtle
()
pen
.
pencolor
(
"blue"
)
for
i
in
range
(
8
):
for
i
in
range
(
5
):
pen
.
forward
(
50
)
pen
.
right
(
72
)
pen
.
right
(
45
)
pen
.
end_fill
()
turtle
.
done
()
\ No newline at end of file
v高房.py
0 → 100644
View file @
99ed4e78
num1
=
input
(
'请输入数字:'
)
num1
=
input
(
'请输入数字:'
)
num2
=
int
(
input
(
'输入次数'
))
sum
=
0
str
=
""
for
i
in
range
(
num2
):
str
=
str
+
num1
sum
=
int
(
str
)
+
sum
print
(
sum
)
\ 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