Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
python Rechner
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Martin Roberto Castillo Hund
python Rechner
Commits
7f83d31e
Commit
7f83d31e
authored
4 years ago
by
Martin Roberto Castillo Hund
Browse files
Options
Downloads
Patches
Plain Diff
app: don't show status in tests, handle /0 better, calculate() return result
parent
c84e94b5
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
app.py
+15
-1
15 additions, 1 deletion
app.py
with
15 additions
and
1 deletion
app.py
+
15
−
1
View file @
7f83d31e
...
...
@@ -10,6 +10,8 @@ class Rechner:
self
.
lastchar
=
''
def
show_status
(
self
):
if
__name__
!=
"
__main__
"
:
return
print
(
"
zahlen:
"
,
self
.
zahlen
)
print
(
"
operatoren:
"
,
self
.
operatoren
)
print
(
"
letztes zeichen:
"
,
self
.
lastchar
)
...
...
@@ -65,9 +67,21 @@ class Rechner:
zahlen
.
append
(
linkeZahl
*
rechteZahl
)
elif
op
==
"
/
"
:
#XXX durch 0?
zahlen
.
append
(
linkeZahl
/
rechteZahl
)
try
:
zahlen
.
append
(
linkeZahl
/
rechteZahl
)
except
ZeroDivisionError
:
# stacks leeren?
zahlen
.
clear
()
operatoren
.
clear
()
return
"
DIVZERO
"
else
:
print
(
"
Unerwarteter Operator in Rechner.calculate():
"
,
op
)
return
"
Unbekanntes Zeichen:
"
+
op
# assert not operatoren
# assert len(zahlen) == 1
return
zahlen
.
pop
()
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment