LU10.L01 - Taschenrechner als Modul

#Add import statement for calc
import calc
 
def main():
    print(calc.add(5,5))
    print(calc.mul(5, 5))
 
 
if __name__ == '__main__':
    main()
#Add import statement for calc
import calc as c
 
def main():
    print(c.add(5,5))
    print(c.mul(5, 5))
 
 
if __name__ == '__main__':
    main()
#Add import statement for calc
from calc import add, mul
 
def main():
    print(add(5,5))
    print(mul(5, 5))
 
if __name__ == '__main__':
    main()
# Add import statement for add as addition and mul as multiplication from calc
from calc import add as addition, mul as multiplication
 
 
def add(num1, num2):
    '''
    Builds the sum of two numbers and prints the result
    :param num1: first number
    :param num2: second number
    :return: None
    '''
    print(num1 + num2)
#Add import statement for calculator in lib package
from lib import calculator
 
def main():
    print(calculator.add(5,5)) # function add from module calc
    print(calculator.mul(5,5)) # function mul from module calc
 
if __name__ == '__main__':
    main()
#Add import statement for add and mul from calculator in lib package
from lib.calculator import add, mul
 
def main():
    print(add(5,5)) # function add from lib.calculator calc
    print(mul(5,5)) # function mul from lib.calculator calc
 
if __name__ == '__main__':
    main()
  • modul/m319/learningunits/lu10/loesungen/taschenrechner.txt
  • Last modified: 2023/12/07 10:51
  • by kmaurizi