HI i am trying to create a chat bot that asks for a certain price point and lists products inside that price point. however i am unsure how to do this. can anyone help.
price = input(f’do you have a specific price point for {product}s ‘)
price == int(price)
prices = {
“rockymountianslayer” : int(1000),
“norcostorm” : int(3000),
“yetisb165” : int(11000),
“yetisb100” : int(4070)
}
mountainbikes = [“rockymountianslayer”,“norcostorm”,“yetisb165”,“yetisb100”]
print(f’{mountainbikes}’)
i believe this part is the problem.
for prices > price:
mountainbikes.remove()
print (f’{mountainbikes}’)
for is an iterator when enabled by an __iter__ attribute on an object. When given an iterable, it iterates it.
for object in iterable:
object in this case will be the item at some location within the iterable. That item could be any object, proper; it just happens to reside at that location.
We are not saying, “for any price in prices greater than the price_point,” as your expression suggests.
I suggest you do a bit of reading on how to iterate through a dictionary. Reading the section Iterating Through .items() at https://realpython.com/iterate-through-dictionary-python/ should help. If you still need help after reading through that, let us know.