Category: Lpthw

LPTHW - Exercise 14: Prompting and Passing

LPTHW - Exercise 14 Not much to say about this one. We've done this stuff lots of times. I guess the only slightly different thing is creating a variable for what we're going to put inside the input() function. There are a couple things required to do in the study drills that change the initial script, so you'll see mine below doesn't specifically match the one on the lesson plan.

Read more...

LPTHW - Exercise 13: Parameters, Unpacking, Variables

LPTHW - Exercise 13 OK then, new stuff here. Turns out I'd heard of this before but they were called libraries. Consequently it took a few minutes to complete the mental abstraction as to what these features/modules as Zed calls then actually are. This is the first bit I've come to and thought "Oh, this is the interesting stuff". I really hope to get through these lessons to the first test and move on to the stuff I've never heard of/encountered.

Read more...

LPTHW - Exercise 12: Prompting People

LPTHW - Exercise 12 Turns out I jumped the gun a little with that extra form I made last time for the Study Questions. This lesson covers the way I made that form... age = input("How old are you? ") height = input("How tall are you? ") weight = input("How much do you weigh? ") print(f"So, you're {age} old, {height} tall and {weight} heavy.") Learn Python the Hard Way - Study Drills 1.

Read more...

LPTHW - Exercise 11: Asking Questions?

LPTHW - Exercise 11 Yay! Some new stuff! I must admit, this first section is getting a little tedious so it's nice to have something new now. It's a common thing with programming tutorials, they all start of with such simple things and take ages to get past them. I think it's been a factor in why it's taken me a while to really want to learn to code.

Read more...

LPTHW - Exercise 10: What was that?

LPTHW - Exercise 10 I'm not sure exactly where, probably when butchering a Regex command, but I'd already encountered escape characters prior to the last exercise. It's obviously a very useful thing to learn, but coming back to it now I can't imagine not knowing what they are, how to look them up, and ultimately how to use them. That's one of the best feelings during the learning process!

Read more...

LPTHW - Exercise 9: Printing, Printing, Printing

LPTHW - Exercise 9 Simple copy and print here but a few things we haven't seen before - namely those \n things in the months variable string. When running the script the output on the months variable are displayed on separate lines, so those \n things obviously indicate a newline/carriage return be inserted. I guess this is a way to get new lines on a string enclosed by single or double quotes, i.

Read more...

LPTHW - Exercise 8: Printing Printing

LPTHW - Exercise 8 Another copy one here but there were things to learn conceptually that haven't been brought up before. Look at how formatter is declared right at the beginning. Throughout the rest of the exercise we just add the relevant data and it'll print in the way set in the formatter variable. I think this is a subtly important concept to begin to learn, that you can setup the structure of how to do something and allow the data to come later, knowing it'll be output how you intended.

Read more...

LPTHW - Exercise 7: More Printing

LPTHW - Exercise 7 This is the start of a rote copying stretch. That said, I did a few bits of my own towards the bottom of the script as you'll see below. Having a play around with the code helps me to get a feel for the different things it does. Just trying something to see what it does is a fun way to learn. I think as time goes by actually reading up on docs first will start to become the more efficient way to do things, but I don't think we're at that stage just yet.

Read more...