Question: im working on a pylint test for my basic calculator and i and one pylint error left which says. 'Either all return statements in a
im working on a pylint test for my basic calculator and i and one pylint error left which says. 'Either all return statements in a function should return an expression, or none of them should. and i cant seem to fix it ive been at it for an hour
this is my code:
making a calculator that output addsubmuldiv
def calculatornum operator, num:
Perform a calculation based on two numbers and a given operator.
try:
num floatnum
num floatnum
if operator :
return num num
if operator :
return num num
if operator :
return num num
if operator :
if num:
return num num
return "Cannot divide by zero"
except ValueError:
return "Invalid input"
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
