Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
bellcode
/
lesson13-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
4385672d
authored
Feb 27, 2022
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
save project
parent
481e8eda
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
46 additions
and
10 deletions
1.py
diy.py
1.py
View file @
4385672d
a
=
[
'你好呀
\n
'
,
'悟空
\n
'
,
'我在贝尔编程学python
\n
'
]
'''
with
open
(
r'C:\Users\Administrator\Desktop\hello.txt'
,
'a'
,
encoding
=
'utf-8'
)
as
file
:
36题
file
.
writelines
(
a
)
r=int(input("请输入圆的半径"))
\ No newline at end of file
print("圆的直径是",2*r)
print("圆的周长是",2*r*3.14)
print("圆的面积是",r**2*3.14)
'''
import
turtle
as
t
t
.
penup
()
t
.
goto
(
0
,
-
200
)
t
.
pendown
()
t
.
circle
(
200
)
t
.
penup
()
t
.
goto
(
-
100
,
50
)
t
.
pendown
()
t
.
fillcolor
(
"blue"
)
t
.
begin_fill
()
t
.
circle
(
20
)
t
.
end_fill
()
t
.
penup
()
t
.
goto
(
100
,
50
)
t
.
pendown
()
t
.
fillcolor
(
"blue"
)
t
.
begin_fill
()
t
.
circle
(
20
)
t
.
end_fill
()
t
.
penup
()
t
.
goto
(
0
,
50
)
diy.py
View file @
4385672d
with
open
(
r'C:\Users\Administrator\Desktop\sales_list.txt'
,
'r'
,
encoding
=
'utf-8'
)
as
file
1
:
with
open
(
r'C:\Users\Administrator\Desktop\sales_list.txt'
,
'r'
,
encoding
=
'utf-8'
)
as
file
:
a
=
file
1
.
readline
()
a
=
file
.
readlines
()
#print(a)
final_sum
=
[]
for
i
in
a
:
for
i
in
a
:
s
=
i
.
split
()
data
=
i
.
split
()
print
(
s
)
sum
=
0
\ No newline at end of file
for
sales
in
data
[
1
:]:
sum
+=
int
(
sales
)
result
=
data
[
0
]
+
str
(
sum
)
+
'
\n
'
final_sum
.
append
(
result
)
with
open
(
r'C:\Users\Administrator\Desktop\sales_list.txt'
,
'a'
,
encoding
=
'utf-8'
)
as
file
:
file
.
writelines
(
final_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