ecookbook restoring the folders for testing...
This commit is contained in:
parent
0574702876
commit
9f40a47d30
109 changed files with 0 additions and 0 deletions
19
docs/eCookbook/examples-for-reddit-posts/coin-calculator.md
Normal file
19
docs/eCookbook/examples-for-reddit-posts/coin-calculator.md
Normal file
|
@ -0,0 +1,19 @@
|
|||
**Coin Calculator **
|
||||
|
||||

|
||||
|
||||
This is an example of a program originally written for tkinter. The length is roughly 1/2 the original program. However, it's the readability of the lines that is the more important difference.
|
||||
|
||||
Note - need to add formatting of the text being output so that it's closer to looking like dollars and cents. This can be done by modifying these 4 lines of code:
|
||||
```python
|
||||
window['Quarters_total'].update(quarters)
|
||||
window['Dimes_total'].update(dimes)
|
||||
window['Nickels_total'].update(nickels)
|
||||
window['Pennies_total'].update(pennies)
|
||||
```
|
||||
|
||||
Use f-strings insead of the variable names directly as paramters to `update`. It seemed better to keep the code simpler looking than add the formatting.
|
||||
|
||||
|
||||
|
||||
<iframe src='https://trinket.io/embed/pygame/4788483a5b?start=result' width='100%' height='550' frameborder='0' marginwidth='0' marginheight='0' allowfullscreen></iframe>
|
Loading…
Add table
Add a link
Reference in a new issue