7 """Runnable to multiply a number by a digit""" 19 time.sleep( self.
param(
'take_time') )
23 self.
dataflow( {
'partial_product' : self.
param(
'partial_product') }, 1)
27 """Function to multiply a number by a digit""" 29 if a_multiplier ==
'':
30 return str(carry)
if carry
else '' 32 prefix = a_multiplier[:-1]
33 last_digit = int(a_multiplier[-1])
35 this_product = last_digit * digit + carry
36 this_result = this_product % 10
37 this_carry = this_product // 10
39 return rec_multiply(prefix, digit, this_carry) + str(this_result)
def param_required(self, param_name)
Returns the value of the parameter "param_name" or raises an exception if anything wrong happens...
def rec_multiply(a_multiplier, digit, carry)
Function to multiply a number by a digit.
Runnable to multiply a number by a digit.
This is the counterpart of GuestProcess.
def param(self, param_name, args)
When called as a setter: sets the value of the parameter "param_name".
def dataflow(self, output_ids, branch_name_or_code=1)
Dataflows the output_id(s) on a given branch (default 1).