No using ... Conditiins or def | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

No using ... Conditiins or def

Take this challenge: ONLY USE 2 LINES of code with parameters of x, y and any one of the operator (+,-,*,/,%) write a calculator function that can calculate +,-,*,/,% operation and print out the result of the operation restriction: 1. can't use 'def' 2. can't use if , elif, nor else

4th Mar 2018, 7:36 AM
Benedict 47
Benedict 47 - avatar
2 Answers
4th Mar 2018, 10:07 AM
David Ashton
David Ashton - avatar
+ 4
print(eval(input())) print("do I have to use second line?")
4th Mar 2018, 10:26 AM
voja
voja - avatar