Jun-20-2020, 08:45 PM
Hello everyone,
I'm new here and a newbie to python, my heart is not on my sleeve so whatever comments made i'm cool with it.
What I'm trying to do below is get the user's input, which will supposedly fill in the variables then calculate what needs to be calculated. The problem is when i run it, it asks for one particular value twice ( def BOM())because of the formula. What i actually would like to happen is once the user types in the requested value, that the value be automatically replicated to wherever the function is being called. Don't know how possible that is.
Oh! by the way I'm using python 2.X
Thanks in advance guys.
Cheers,
I'm new here and a newbie to python, my heart is not on my sleeve so whatever comments made i'm cool with it.
What I'm trying to do below is get the user's input, which will supposedly fill in the variables then calculate what needs to be calculated. The problem is when i run it, it asks for one particular value twice ( def BOM())because of the formula. What i actually would like to happen is once the user types in the requested value, that the value be automatically replicated to wherever the function is being called. Don't know how possible that is.
Oh! by the way I'm using python 2.X
Thanks in advance guys.
Cheers,
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
def BOM(): bm = [] while True : l_a = int ( raw_input ( "BOM per item: " )) if l_a = = "done" : break bm.append(l_a) bm = np.asarray(bm) return bm def scrap(): scrp = [] while True : l_b = int ( raw_input ( "Scrap percentage per item: " )) if l_b > 1 : l_b = l_b / float ( 100 ) scrp.append(l_b) return l_b wd_kg_itm = (BOM() * scrap()) + BOM() print ( "Wood kg per item is {0}" . format (wd_kg_itm)) |