Dear all,
I am a student in university and a professor teaching python provided an function example
I am a student in university and a professor teaching python provided an function example
def calculator(num1=int(input("Type your first number:")), operator=input("Enter your +,-,*,/:"), num2=int(input("Type our second number:"))): calculator={"+":f"{num1+num2}","-":f"{num1-num2}","*":f"{num1*num2}","/":f"{num1/num2}"} print(num1,operator,num2,"=",calculator[operator]) calculator()In my opinion, function should serve single activity. So I think the user interactive function "num1=int...,operator=...,num2=...." should be moved to another function which just deal with user input. I think her codes violates OOP-design-principles like "Single Responsibility Principle". Am I right? I never seen so many things with in a function brackets...