Day 010 - Project 10 : Extend your bill calculator

If you have any questions, comments or issues with this project please post them here!

Just curious about choice of variable name consistency.

myBill = float(input("What was the bill?: "))
numberOfPeople = int(input("How many people?: "))
tip = int(input("What percent tip do you want to leave: 15, 18, or 20 percent?"))


bill_with_tip = tip / 100 * myBill + myBill
bill_per_person = bill_with_tip / numberOfPeople
final_amount = round(bill_per_person, 2)


print("You all owe", final_amount)

As it’s a Python course, I’d love it if you followed PEP8 and used snake case. Having programs where you mix snake case and camel case seems a strange choice. What’s the thinking?

1 Like

I’m just speculating, but could be that he originally learned another language and that guidance is more in his head.
It isn’t an issue, but I agree would be clearer to mention the main expected styling guidelines and follow those.

The example I pasted was one that @DavidAtReplit put in his solution. It wasn’t one that my learner did. That’s where my confusion came. :slight_smile:

This was before I recorded myself doing the solutions, so other people may have contributed them. I take your point though, my hope is to loop back around and make solution videos for the earlier lessons so I can redo them in a more consistent way.

4 Likes

Built my own tip calculator! Time to put it to the test at a restaurant :pizza: !

https://replit.com/@JackAdem/Day-010-Project-10-Extend-your-Bill-Calculator?v=1

Day 10 of #Replit100DaysOfCode #100DaysOfCode.

2 Likes

Question:
I don’t understand this, I can’t get the math correct on it. Can anybody help? I know this isn’t a big question, but if you look at the replit you can probably see what I mean. Thank you,
Not A School Assignment It’s 100 Days Of Code Like The Link Says
Repl link:
https://replit.com/@Chandler0Bing/100-Days-Of-Code-Day-10

You should change the category to #100-days-of-code

3 Likes

@JayAySeaOhBee14 Do you know what I might have done wrong?

What’s wrong with it, can you specify an error.

1 Like

I’m not good with math stuff, but that if statement is horrendous…

if what.lower() in ('yes', 'ye', 'y'):

You’ll learn about lower() soon, but basically it just converts a string to all lowercase. The parentheses are a tuple, you can use square brackets so it’s a list if you’d like.

1 Like

you could also do:

if what.lower() in ["yes", "ye", "y"]:
    pass # put some random func

Oh yeah, I forgot about that since I just use the parentheses trick now.

I’m looking at it rn @Chandler0Bing

This post was flagged by the community and is temporarily hidden.

1 Like

Here is what I did:
image

2 Likes

I had no idea about that with the parentheses. I wish I had known that long ago. It would have saved me so much effort. Now though I do what @functionally said and use if a in b instead.

1 Like

This post was flagged by the community and is temporarily hidden.

1 Like

This post was flagged by the community and is temporarily hidden.

This post was flagged by the community and is temporarily hidden.