modul:archiv:m319python:learningunits:lu11:loesungen:taschenrechner

LU11.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 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/archiv/m319python/learningunits/lu11/loesungen/taschenrechner.txt
  • Zuletzt geändert: 2024/03/28 14:07
  • von 127.0.0.1