global_sulfur=0
global_charcoal=0
global_gun_powder=0
global_low_grade_fuel=0
global_metal_frags=0
global_stone=0
global_tech_trash=0
global_cloth=0
global_explosives=0
global_rope=0
global_small_stash=0
global_beancan_grenade=0
global_metal_pipe=0
global_spring=0
global_animal_fat=0
def calculate():
list={"Sulfur" : global_sulfur ,"Charcoal" : global_charcoal ,"Gun Powder" : global_gun_powder ,"Low Grade Fuel" : global_low_grade_fuel , "Metal Frags" : global_metal_frags , "Stone" : global_stone , \
"Tech Trash" : global_tech_trash ,"Cloth" : global_cloth ,"Explosives" : global_explosives ,"Rope" : global_rope ,"Small Stash" : global_small_stash ,"Beancan Grenades" : global_beancan_grenade ,"Metal Pipe" : global_metal_pipe \
,"Spring" : global_spring ,"Animal Fat" : global_animal_fat}
Theres 700+ more lines,but we want to make this questions simple,just think of the least of the variables will have a value over one。如果字典中的语句打印一个键和值,如果该值大于一,我该怎么办?
我试过多种方式和无数的时间,试图找到一种方法,使该值是否超过键值,将打印价值和键超过1
你不应该影响'list',特别是不能用*实际上不是列表*的东西。你也应该阅读教程。 – jonrsharpe