Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
bellcode
/
lesson2-5_DIY1
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
9ec13607
authored
Apr 03, 2021
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
save project
parent
97b86727
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
54 additions
and
14 deletions
func.py
玩儿.py
菜单.py
func.py
0 → 100644
View file @
9ec13607
def
new_input
():
a
=
[]
while
True
:
b
=
input
(
"请输入菜品价格:"
)
if
b
==
'q'
:
break
else
:
try
:
b
=
int
(
b
)
except
:
print
(
"请重新输入一个数字"
)
else
:
a
.
append
(
b
)
finally
:
print
(
"========"
)
return
a
def
sum
(
money
):
count
=
0
for
i
in
money
:
count
=
count
+
i
return
count
# price=new_input()
# pay=sum(price)
# print("您一共消费了"+str(pay)+"元!扫码还是现金呢?")
\ No newline at end of file
玩儿.py
0 → 100644
View file @
9ec13607
filel
=
open
(
r"C:\Users\lenovo\Desktop\xxxx.txt"
,
'a'
,
encoding
=
'utf-8'
)
filel
=
open
(
r"C:\Users\lenovo\Desktop\xxxx.txt"
,
'a'
,
encoding
=
'utf-8'
)
filel
.
write
(
'小兰:12本
\n
'
)
filel
.
write
(
'随机:12本
\n
'
)
filel
.
write
(
'小明:11本
\n
'
)
filel
.
close
()
\ No newline at end of file
菜单.py
View file @
9ec13607
def
n
ew_input
():
def
n
ew_input
():
def
new_input
():
def
new_input
():
a
=
[]
a
=
[]
while
True
:
while
True
:
try
:
b
=
input
(
"请输入菜品价格:"
)
b
=
input
(
"请输入菜品价格:"
)
if
b
==
'q'
:
if
b
==
'q'
:
break
break
b
=
int
(
b
)
except
:
print
(
"请输入数字:"
)
else
:
else
:
a
.
append
(
b
)
try
:
return
a
b
=
int
(
b
)
result
=
new_input
(
a
)
except
:
print
(
result
)
print
(
"请重新输入一个数字"
)
else
:
\ No newline at end of file
a
.
append
(
b
)
finally
:
print
(
"========"
)
return
a
def
sum
(
money
):
count
=
0
for
i
in
money
:
count
=
count
+
i
return
count
price
=
new_input
()
pay
=
sum
(
price
)
print
(
"您一共消费了"
+
str
(
pay
)
+
"元!扫码还是现金呢?"
)
\ 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