3
Parzi
5y

My instructor:

start
Declarations
num test1
num test2
num test2
num average
output "Enter score for test 1
input test1
output "Enter score for test 2 "
input test2
output "Enter score for test 3 "
input test3
average = test1 + test2 + test3 / 3
output "Average is ", answer
end

Me:

print("Average is "+str((int(raw_input("Enter score for Test 1\nInt> "))+int(raw_input("Enter score for Test 2\nInt> "))+int(raw_input("Enter score for Test 3\nInt> ")))/3))

Comments
  • 7
    if you're doing low-level (or code golf), your approach is objectively better.

    if you're not, and especially if someone else is going to maintain it, shame on you! Add some newlines so it's readable.
  • 1
    Absolutely beautiful.
  • 2
    @Root one-off code, based on my instructor's (bad) pseudocode, as he requested. No maintenance in future, no usage in future outside my instructor running it literally once to ensure it works, etc. I decided to focus on efficiency and size, as it's an Intro to CIS class and i wanna be impressive. Obviously code I think people will use more than just one or two times (or will be modified at all) won't look like this.
  • 2
    @Parzi Don't take my criticisms too harshly; I kind of assumed that anyway. Except the intro to CIS part! (That was a compliment, by the way. 🙂)
  • 0
    @Root my bad, today's been a shit day. (Well, yesterday. Technically.)
Add Comment