-
Notifications
You must be signed in to change notification settings - Fork 12.5k
My Shopping python program #1521
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Please you can correct and lecture me on some stuffs am a beginner |
@Kim-Venom Here are a few changes that I would make, but I'm also newer to python. I added f strings to make it easier to read and write the code, I also was able to get rid of the need to be so redundant with adding the print statements. I did remove the os.clear because I could not see why it was needed, but you can add it back in if needed. Hope this helps some. If the f strings don't work for you then you are using python 2 and should uninstall it and start using python 3 as python 2 is at end of life and not under active dev anymore.
|
Thanks so much I really appreciate it |
@Kim-Venom |
made function "details" of repeating codes#removed "shopping" and globalisation of the value of shopping_cart import time shopping_cart = 0 def details(element, itemPrice, noOfItemInShoppingCart): while shopping_cart < 20:
|
#a shopping program that sells add and check out to customers
import time
import os
shopping_cart = 0
total_price = 0
item_list = []
#shopping function
def shopping ():
global shopping_cart
global total_price
shopping()
The text was updated successfully, but these errors were encountered: