Argument of type 'type' is not iterable.How? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Argument of type 'type' is not iterable.How?

Im getting an error message saying that Agrument of 'type' is not iterable https://github.com/cloroxide/Problems/blob/master/Game%20Test when i test it in this order input -> mall input -> coffee The error message should pop up Tried to change the while loop part to a for loop but , still the same and I can't find any answers on a single website Why is this happening? The loop? The list? The input?

11th Jul 2020, 4:37 PM
slawbear
slawbear - avatar
4 Answers
+ 5
There is an issue, starting in line 49 with: if "coffee" in list: # should be >if "coffee" in items:< There is no list with name "list" in the code, but you have defined a list with name "items", that is used to store what user orders. There are also other parts of the code where "list" is used instead of "items". If you correct it, the code will run without that problem.
11th Jul 2020, 5:30 PM
Lothar
Lothar - avatar
+ 3
At some point of time, you're probably doing something like: obj = type(anotherobj) for I in obj: #code Find it and fix it.
11th Jul 2020, 5:03 PM
👑 Prometheus 🇸🇬
👑 Prometheus 🇸🇬 - avatar
+ 2
cloroxide , i just worked a bit on the code to fix your mentioned issue. But i did not check for logical behaviour. For me the code looks good 👍👍.
13th Jul 2020, 11:50 AM
Lothar
Lothar - avatar
+ 1
out of the topic question, is my code okay? im just a beginner am im playing practicing with python.
13th Jul 2020, 3:43 AM
slawbear
slawbear - avatar