Skip to content

Latest commit

 

History

7 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 

Repository files navigation

Bill-Splitter-Python

Work on your Python basics such as loops, take a look at more advanced data structures like dictionaries and the random module, and learn how to handle occurring errors and exceptions. You can also get to know the Pycharm Edu IDE while developing an app for managing expenses during your next dine-out.

Stage 1 - Invite your friends 1. Take user input — how many people want to join, including the user; 2. In case of an invalid number of people (zero or negative), "No one is joining for the party" is expected as an output; 3. Otherwise, take the friends' names as input, iteratively; 4. Store them in a dictionary initialized with zeros; 5. Print out the dictionary.

Stage 2 - The bill has arrived 1. If there are no people to split the bill (the number of friends is 0 or an invalid input), output "No one is joining for the party"; 2. Else, take user input: the final bill; 3. Split the total bill equally among everyone; 4. Round the split value to two decimal places; 5. Update the dictionary with the split values; 6. Print the updated dictionary.

Stage 3 - The Lucky One 1. In case of an invalid number of people, "No one is joining for the party" is expected as an output; 2. Otherwise, ask the user whether they want to use the "Who is lucky?" feature; 3. Take input from the user; 4. If a user wants to use the feature (Yes), choose a name from the dictionary keys at random and print the following: {Name} is the lucky one!; 5. If the user enters anything else, print No one is going to be lucky.

Stage 4 - Party is over 1. In case of an invalid number of people, "No one is joining for the party" is expected as an output; 2. Otherwise, if the user choice is Yes, re-split the bill according to the feature; 3. Round the split value to two decimal places; 4. Update the dictionary with new split values and 0 for the lucky person; 5. Print the updated dictionary; 6. If the user entered anything else instead of Yes, print the original dictionary.

About

Basic Course for Python

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages