tip15 = 0
tip20 = 0
price = input ("how much did your meal cost?")
tip15 = int (price) * .15
tip20 = int (price) * .2
print ("A 20% tip would be ",tip20," and a 15% tip would be",tip15)
I wrote a tipper program for an exercise.
It's a simple program and it took 20mins to write including several bug fixes,
where I had to go back to looking through the textbook and a few glances at my first program,
before I got it running properly. I made the usual noob mistakes - since I've tackled many different languages, I had to figure out if I needed to declare variables.
I also got the variable on the wrong side of the equals sign, then I forgot to include commas in my print statement for the variables. I also forgot to state that the variable was an integer. Finally, I forgot to use brackets and then incorrectly included the calculation inside the brackets.
Eventually, I figured all of this out and came up with the above seemingly simple program.
And it works!
I'm still not using comments, but I'll fix that when I start writing longer programs.