Python

GORDON
Site Admin
Posts: 54542
Joined: Sun Jun 06, 2004 10:43 pm
Location: DTManistan
Contact:

Post by GORDON »

BTW I got a python right here in my pants.

Talking bout my penis
"Be bold, and mighty forces will come to your aid."
TheCatt
Site Admin
Posts: 53959
Joined: Thu May 20, 2004 11:15 pm
Location: Cary, NC

Post by TheCatt »

Malcolm wrote:Is it a lot of actuarial computing, then?
It's a boatload of $$$
It's not me, it's someone else.
Malcolm
Posts: 32040
Joined: Fri May 21, 2004 1:04 pm
Location: Minneapolis

Post by Malcolm »

Eh, programming is programming. All the fun mathy parts happen prior to that. One of my chief complaints about where I work now is the willful and active ignorance displayed when numbers and formula are in play.
Diogenes of Sinope: "It is not that I am mad, it is only that my head is different from yours."
Arnold Judas Rimmer, BSC, SSC: "Better dead than smeg."
thibodeaux
Posts: 8056
Joined: Thu May 20, 2004 7:32 pm

Post by thibodeaux »

Now you're just trolling.
Malcolm
Posts: 32040
Joined: Fri May 21, 2004 1:04 pm
Location: Minneapolis

Post by Malcolm »

I've seen code devoid of design, forethought, or analysis. Shit, I've written it. I've also gone the other route and it's forced me to see programming as another form of mathematics. I just translate it to machine instructions. Most commercial coders I've known don't simply suck at math, they recoil in horror from anything worse than high scoop algebra.



Edited By Malcolm on 1451004895
Diogenes of Sinope: "It is not that I am mad, it is only that my head is different from yours."
Arnold Judas Rimmer, BSC, SSC: "Better dead than smeg."
GORDON
Site Admin
Posts: 54542
Joined: Sun Jun 06, 2004 10:43 pm
Location: DTManistan
Contact:

Post by GORDON »

I was once asked by a child if math was important to be a computer programmer. I said "Sometimes, but the main importance of math is to teach you how to think logically."

Honestly, as a typical business programmer I rarely had to do anything beyond / * + and -.
"Be bold, and mighty forces will come to your aid."
User avatar
Troy
Posts: 7237
Joined: Mon Jun 07, 2004 8:00 am

Post by Troy »

print("This is a mortgage calculator that will find your monthly payment" + "
")
principle = input("What is the loan amount?" + "
")
principle = int(principle)
interest = input("What is the interest rate?" + "
")
interest = float(interest)
monthlyinterest = (interest * .01)/12
yearsofpayments = input("How many years would you like to make payments?" + "
")
yearsofpayments = int(yearsofpayments)
totalpayments = yearsofpayments * 12
term = (1 + monthlyinterest) ** totalpayments
paymentamt = principle * (monthlyinterest * term) / (term-1)
paymentamt = float(paymentamt)

print("monthly interest of {0:.3f}".format(monthlyinterest))
print("principle of {0:D}".format(principle))
print("term of {0:.3f}".format(term))

print("
" + "Your house would have a monthly payment of {0:,.2f}".format(paymentamt))


the video i was watching wrote the formula for this challenge totally wrong, it seemed like a weird test


e: the board auto captalizes "d" because it's a dickhead




Edited By Troy on 1451020129
Malcolm
Posts: 32040
Joined: Fri May 21, 2004 1:04 pm
Location: Minneapolis

Post by Malcolm »

Honestly, as a typical business programmer I rarely had to do anything beyond / * + and -.

I've occasionally had to break out exponents, the exponential function, logarithms, and the odd bit-wise operation. Outside of simple tree methods, I've never needed what I consider to be "real" algorithms, that is getting a solution through something besides brute force alone. However, it's nice knowing that kind of shit just in case it comes up. I did most of my grad work on this, this, and this. I have yet to encounter a commercial/biz problem in my working life that needs weaponry of that calibre or the umpteen zillion different kinds of time and space analyses I got indoctrinated with.

We once had the internal R&D department at work come up with a predictive thingy for us. It involved a little more than that but not much. Sophomore shit and nothing but a linear model. That said, no one could figure out how to plug the input args into it or what they were without calling them up. Then I got a look at it and explained it to my manager. He thought I was wrong and made me call up the R+D dude on the phone because I wouldn't back off. The guy on the other end of the line (who now works for Google), in his Americanized German accent, confirmed everything I said.

All the interviews I've run, all the candidates I've suffered through ... most of them can't write a Fibonacci function, let along write it the efficient way. I used to be incredulous when my LISP professor told us that most real world programmers fuck up writing a binary search method. Turns out he was right.

Perhaps the most important thing I've learned over the years -- there are lots of people who can churn out code; there aren't many who know what to do before you start coding or what quality code looks like. They just hack and god help you if you have to maintain their shit.




Edited By Malcolm on 1451021507
Diogenes of Sinope: "It is not that I am mad, it is only that my head is different from yours."
Arnold Judas Rimmer, BSC, SSC: "Better dead than smeg."
User avatar
Troy
Posts: 7237
Joined: Mon Jun 07, 2004 8:00 am

Post by Troy »

Malcom bring you curmudgeon ass to SF and teach me to code, thanks
Malcolm
Posts: 32040
Joined: Fri May 21, 2004 1:04 pm
Location: Minneapolis

Post by Malcolm »

Troy wrote:Malcom bring you curmudgeon ass to SF and teach me to code, thanks
I have actually looked at a Cali job in the past year, but it was near LA.
Diogenes of Sinope: "It is not that I am mad, it is only that my head is different from yours."
Arnold Judas Rimmer, BSC, SSC: "Better dead than smeg."
TPRJones
Posts: 13418
Joined: Fri May 21, 2004 2:05 pm
Location: Houston
Contact:

Post by TPRJones »

They just hack and god help you if you have to maintain their shit.

Well, you'd never want to work with me, then. :p I can sometimes make magic, but the code I come up with to do it will be hacked all to hell and gone.

Most my "programming" these days is specifically for the purpose of manipulating numbers and doing math upon them. But that's what the computer is for, I don't have to do the math myself. You only need enough math to know how to code the formulas, not actually carry out the calculations.
"ATTENTION: Customers browsing porn must hold magazines with both hands at all times!"
Malcolm
Posts: 32040
Joined: Fri May 21, 2004 1:04 pm
Location: Minneapolis

Post by Malcolm »

If something's one shot, then I don't care. If it's meant to be reused, it needs to be designed and thought out properly. The product I work on now has four different frameworks to query one fucking DB. FOUR. Three are hack jobs. One is so high-level, it's worthless.

One's nothing but a monolithic hack job and no one's really sure how it all works.
Another is abstract to a fault.
A third was obviously a rushed process they brute forced.
The fourth is literal to a fault.
Diogenes of Sinope: "It is not that I am mad, it is only that my head is different from yours."
Arnold Judas Rimmer, BSC, SSC: "Better dead than smeg."
TPRJones
Posts: 13418
Joined: Fri May 21, 2004 2:05 pm
Location: Houston
Contact:

Post by TPRJones »

Well, I'm nowhere near that bad, at least.
"ATTENTION: Customers browsing porn must hold magazines with both hands at all times!"
Malcolm
Posts: 32040
Joined: Fri May 21, 2004 1:04 pm
Location: Minneapolis

Post by Malcolm »

The plan is to integrate them all into one next year sometime. Once you excise the stupidity inherent in the literal one, it's quite fluid. I got repeatedly yelled at for pointing out said stupidity at its inception.
Diogenes of Sinope: "It is not that I am mad, it is only that my head is different from yours."
Arnold Judas Rimmer, BSC, SSC: "Better dead than smeg."
User avatar
Troy
Posts: 7237
Joined: Mon Jun 07, 2004 8:00 am

Post by Troy »

I wrote a very simple - yet awesome to me - hangman program on Saturday.

Reading a file, randomly picking a string out of an object, providing a graphical output to a user than changed based on their inputs, success and fail branches, all that sexy stuff. Hardest thing I had to do was figure out how to change each instance of a letter in the _ _ _ _ output instead of just one.

Then Sunday I spent the day figuring out why the Tower of Hanoi problem is solved using recursive functions. And then the Panthers lost. So Saturday was a lot better than Sunday.
Malcolm
Posts: 32040
Joined: Fri May 21, 2004 1:04 pm
Location: Minneapolis

Post by Malcolm »

Then Sunday I spent the day figuring out why the Tower of Hanoi problem is solved using recursive functions.

If you can master recursion, you beat out 50% of the intro programmers out there. It's inefficient but elegant. If you want to fuck with your brain, try writing the Hanoi solution without recursion. Try a Fibonacci generator or factorial calculator next. I'd recommend hitting trees (specifically binary search trees) after that.

providing a graphical output to a user

Ah, ASCII. Think my first programmed game was Tic-Tac-Toe.




Edited By Malcolm on 1454974883
Diogenes of Sinope: "It is not that I am mad, it is only that my head is different from yours."
Arnold Judas Rimmer, BSC, SSC: "Better dead than smeg."
TheCatt
Site Admin
Posts: 53959
Joined: Thu May 20, 2004 11:15 pm
Location: Cary, NC

Post by TheCatt »

Quick, introduce him to MVC.
It's not me, it's someone else.
User avatar
Troy
Posts: 7237
Joined: Mon Jun 07, 2004 8:00 am

Post by Troy »

Malcolm wrote:Try a Fibonacci generator or factorial calculator next. I'd recommend hitting trees (specifically binary search trees) after that
Had done these already in a non openware book. They were much easier to grapple. Will check binary trees out next as that's the second time it was mentioned to me.

Actually there's a file called rabbitsfucking.py on one of my machines somewhere.
User avatar
Troy
Posts: 7237
Joined: Mon Jun 07, 2004 8:00 am

Post by Troy »

TheCatt wrote:Quick, introduce him to MVC.
I think this is what Django is. I told would try to finish the course before I moved on to the next thing though :)
Malcolm
Posts: 32040
Joined: Fri May 21, 2004 1:04 pm
Location: Minneapolis

Post by Malcolm »

Django looks like a Python web framework, so I bet it has objects to implement the MVC pattern. That said, it doesn't hurt to know what it is on a conceptual level, because you could hear it applied to anything from webpage design to an individual widget in a UI. You'll also hear it riffs on it like MVP or MVVP or other bullshit acronyms that differ just enough for some desperate loser HCI graduate to write a thesis or dissertation on them.

After you can handle trees, I might focus a bit on DB interaction.
Diogenes of Sinope: "It is not that I am mad, it is only that my head is different from yours."
Arnold Judas Rimmer, BSC, SSC: "Better dead than smeg."
Post Reply