Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
Python-mini-projects
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Issue analytics
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
dhana surya
Python-mini-projects
Commits
e3d3e3db
Commit
e3d3e3db
authored
2 months ago
by
dhana surya
Browse files
Options
Downloads
Patches
Plain Diff
tip calculator completed
parent
4a17d485
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
cs50-python-problem-set/problem-set-0/tip.py
+5
-13
5 additions, 13 deletions
cs50-python-problem-set/problem-set-0/tip.py
with
5 additions
and
13 deletions
cs50-python-problem-set/problem-set-0/tip.py
+
5
−
13
View file @
e3d3e3db
...
...
@@ -3,18 +3,10 @@ Calculate the tip using python
"""
def
main
():
dollars
=
dollars_to_float
(
input
(
"
How much was the meal?
"
))
percent
=
percent_to_float
(
input
(
"
What percentage would you like to tip?
"
))
tip
=
dollars
*
percent
print
(
f
"
Leave $
{
tip
:
.
2
f
}
"
)
def
dollars_to_float
(
d
):
# TODO
def
percent_to_float
(
p
):
# TODO
#get input and typecast into int
dollars
=
int
(
input
(
"
How much was the meal?
"
))
percent
=
int
(
input
(
"
What percentage would you like to tip?
"
))
tip
=
dollars
*
percent
/
100
print
(
f
"
Leave $
{
tip
:
.
2
f
}
"
)
main
()
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