Nov-05-2017, 02:47 PM
(This post was last modified: Nov-05-2017, 02:55 PM by Wilson1218.)
(Nov-05-2017, 12:41 PM)Lux Wrote: I think you need to declare your total_kg and rejected variables before the bag_check function, then use them globally, like this:
total_kg = 0 rejected = 0 def bag_check(material, weight, total_kg, rejected): global total_kg global rejected # the rest of the function
It didn't work, I get the error "name 'total_kg' is parameter and global"
(Nov-05-2017, 02:47 PM)Wilson1218 Wrote:(Nov-05-2017, 12:41 PM)Lux Wrote: I think you need to declare your total_kg and rejected variables before the bag_check function, then use them globally, like this:
total_kg = 0 rejected = 0 def bag_check(material, weight, total_kg, rejected): global total_kg global rejected # the rest of the function
It didn't work, I get the error "name 'total_kg' is parameter and global"
Fixed it, simple parameter error. Thanks!