Thank you Zed Shaw

Incredible! Two weeks ago I was looking at code the way a 4 a.m. drunk looks at Chinese algebra.

Now I’m on Exercise 36 of “Python the Hard Way”! And I can do this! . . . (see brilliant code below – (indents lost when I pasted). By God the code actually works!).

I’m completely floored by this. It’s not just a dream: I can actually learn how to code and I will learn how to code. I was always too intimidated (& busy with the working life) to try. Now it’s like new horizons of intellectual exploration are opening up. I have a fair amount of math chops and investment chops – so this will be quite a tool to mess around with.

Thank you Zed Shaw for this amazingly good book.

def add(x,y):
    z = x + y
    return z

def multiply(u,v):
    z1 = u * v
    return z1

x = float(input("Give me an x: ", ))
y = float(input("Give me a y: ", ))
z = add(x,y)

print(">>>>>I'm after the \"add\" function call.")

u = float(input("Give me a u: ", ))
v = float(input("Give me a v: ", ))
z1 = multiply(u,v)
print(">>>>>I'm after the \"multiply\" function call.")

t = "end"
print(">>>>>I'm after t=", t)

while t == "end":
    answer = float(input(f"What is {x} + {y}? ", ))
    if answer == z:
        t = "knot"
        print("Try again.")
        print(f"t still equals \"{t}\" ")

print(f"You win a special bonus calculation! No need to do this in your head: {u} times {v} =", z1)

Wow, that’s really good progress. Don’t get discouraged if you slow down a lot toward the end of the book. It ramps up quite a lot, but keep plugging away at it and you’ll get it. Your math background will help a lot, but Object Oriented Programming (OOP) is weird and hard to understand.

And, when you post code, you can do this to make it look nicer:

# code here

I already did that for you in this code. Also, did you have a question about that code or just wanted to show folks?

1 Like

Just showboating my newly acquired beginner coding chops! :wink:

I got downsized & laid off from my prestigious investment industry job and have lots of free time. Want to get to the point I understand machine learning and AI neural networks with tensor flow and related tools. And all the Python math libraries. Mostly AI is just linear algebra, calculus and statistics anyway, so I’m not intimidated! Coding did intimidate me though. It frankly still does. To be honest.

Ah, then you should be checking out:


@Mark_H hey good job! welcome to the community. Keep it going!