Joseph Gulizia schreef op 2015-08-20 05:12:
Assume that the grader defines two variables A and B for you. Write a
program which prints out the value
min(A, B)

However, there is a catch: your program is not allowed to use the min
function. Instead, use max in a clever way to simulate min.
--------------------------------------
Code that gave best results but didn't work for negative numbers...
--------------------------------------

Original = abs(max (-A, -B))
print (Original)

--------------------------------------
Did not pass tests.

You change the sign of A and B before passing them to max(). To revert that afterwards, you just need to change the sign of the result again.

abs() indeed doesn't work for that: it only changes the sign on negative numbers, not on positive numbers.


Regards,
Roel

--
The saddest aspect of life right now is that science gathers knowledge
faster than society gathers wisdom.
  -- Isaac Asimov

Roel Schroeven

_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

Reply via email to