repl.it
@katiewinton/

Shopping Basket and invert stuff

Python

No description

fork
loading
Files
  • main.py
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# shoppingBasket = {}
# string = '\n'+'Shopping Basket Options'+'\n'+'-----------------------'+'\n'+'  1. Add an item'+'\n'+'  2. Remove an item'+'\n'+'  3. View Basket'+'\n'+'  4. Exit Program'+'\n'
# print(string)
# option = input('Enter an option: ')
# while option == '3' or option == '2' or option == '1':
#   if option == '1':
#     item = input('Enter an item (no caps, singular): ')
#     quantity = input('Enter a quantity: ')
#     shoppingBasket[item] = quantity
#     print('Adding '+quantity,item+'s.')
#   elif option == '2':
#     delete = input('Enter a item to remove: ')
#     quantity = input('Enter a quantity: ')
#     while int(quantity) > int(shoppingBasket[delete]):
#       quantity = input('Your quantity was larger than the amount of '+delete+'s in your basket. Please enter another quantity: ')
#     shoppingBasket[delete] = str(int(shoppingBasket[delete])-int(quantity))
#     if shoppingBasket[delete] == '0':
#       del(shoppingBasket[delete])
#     print('Deleting '+quantity, delete+'s.')
#   else:
#     if len(shoppingBasket) == 0:
#       print('You have nothing in your shopping basket.')
#     else:
#       for key in shoppingBasket:
#         print('You have '+shoppingBasket[key], key+'s.')
#   option = input('Enter an option: ')

# string = input('')
# def invert():
#   new = ''
#   for i in range(len(string)):
#     new+=string[(len(string)-1)-i]
#   print(new)
# invert()

dictionary = {'blah':'blah', 'hi':'hi', 'goto':'goto'}
newDict = {}
def invertDict():
  keys = dictionary.keys()
  counter = len(keys)-1
  
invertDict()
?