Challenge: create a program that takes three numbers as arguments and returns the largest of them.
At first I got all confused and started making unnecessary loops. It was very frustrating.
Then Ken reminded me that when creating a program, first you must think about it logically, forget about the sintax: what does your program need to do? how would a human do that? how would you explain it in pen and paper?
That made things a lot easier. IMPORTANT ADVICE TO REMEMBER.
So then, basically what I did was assume that the first integer given by the user was the biggest one, created a variable for it, and then I compared it with the other values and changed it if necessary.
Here’s my code, hope it’s helpful: https://github.com/cpvp20/max_of_three
sources:
Leave a comment