Current Events > ITT: Learning Python

Topic List
Page List: 1, 2, 3
kirbymuncher
07/04/21 7:59:27 PM
#51:


SpiritSephiroth posted...
Once I'm done with the rest of these Im going to almost exclusively rely on my own coding while looking stuff up.
depending on how much you like little math/coding problem things this site might be of interest https://projecteuler.net/ (that said if you have actual ideas of things you want to code already, I'd say go with those instead)

the problems eventually learn a lot more toward the math side of the math/programming split but I'd sometimes use this for getting used to new languages. you've got problems ranging from relatively simple stuff like this https://projecteuler.net/problem=2 to more complicated stuff like https://projecteuler.net/problem=67


---
THIS IS WHAT I HATE A BOUT EVREY WEBSITE!! THERES SO MUCH PEOPLE READING AND POSTING STUIPED STUFF
... Copied to Clipboard!
SpiritSephiroth
07/04/21 8:04:46 PM
#52:


kirbymuncher posted...
depending on how much you like little math/coding problem things this site might be of interest https://projecteuler.net/ (that said if you have actual ideas of things you want to code already, I'd say go with those instead)

the problems eventually learn a lot more toward the math side of the math/programming split but I'd sometimes use this for getting used to new languages. you've got problems ranging from relatively simple stuff like this https://projecteuler.net/problem=2 to more complicated stuff like https://projecteuler.net/problem=67

Oh thanks, I'll put this in my list of resources

---
... Copied to Clipboard!
SomeLikeItHoth
07/05/21 6:02:14 AM
#53:


@kirbymuncher what Python books would you recommend? The last one I read was Python Crash Course which was pretty good but now I need a new book. I'm thinking about getting Effective Python: 90 Ways to Write Better Python.

---
FAM FOREVER.
... Copied to Clipboard!
g980
07/05/21 9:16:28 AM
#54:


Watch Raymond Hettinger videos when you can

He is one of the developers of python and an amazing public speaker
---
These old bones live to learn her wanton ways:
(I measure time by how a body sways).
... Copied to Clipboard!
kirbymuncher
07/05/21 9:42:34 AM
#55:


SomeLikeItHoth posted...
what Python books would you recommend? The last one I read was Python Crash Course which was pretty good but now I need a new book. I'm thinking about getting Effective Python: 90 Ways to Write Better Python.

I'm not super great with python myself and I've mostly just learned from incrementally looking things up online so I can't really give specific book advice. just make sure you don't find something about python2

---
THIS IS WHAT I HATE A BOUT EVREY WEBSITE!! THERES SO MUCH PEOPLE READING AND POSTING STUIPED STUFF
... Copied to Clipboard!
SpiritSephiroth
07/05/21 9:43:30 PM
#56:


... Copied to Clipboard!
pojr
07/05/21 9:45:23 PM
#57:


I've seen this topic come up here and there on the list, and decided to add a post to it. I actually have been sort of learning python. I'm taking a fake MIT course, basically I'm just spectating the class and doing the assignments on my own, not officially or anything. I'm learning quite a bit from it, although I don't see a practical use for it yet. It is really cool.

---
pojr
I summon it. You spell it.
... Copied to Clipboard!
Atralis
07/05/21 9:58:44 PM
#58:


1337toothbrush posted...
I actually hate Python because of its performance issues, dynamic typing, use of indents to indicate blocks of code, and some other things. It's a decent learning language, I suppose, but particularly the lack of type notation doesn't force beginners to think enough about their datatypes and I think that'll come back to bite them. Python's excuse for enforcing indents is to get programmers into good habits, but formatters can do that stuff automatically. Meanwhile it's harder for tools to automatically determine what the intent of the programmer is with dynamic typing (e.g. did you mean to assign a string to a variable that held a number or was it a goof?).

I support Python as a foot in the door language and then you move to something like C++, Java, or C# (Microsoft Java) for Data structures level stuff. IDE's help a lot with telling people "wait a second this type returned doesn't match this type you are expecting" as they are coding.

I disagree with it being a bad starter language. There is a lot of confidence and basic programming skills to be gained by having someone do things like the TC is doing (taking inputs, assigning them to variables, and then doing something, even prints with the outputs) or working with lists or arrays or whatever data structures.

The indentation mattering stuff is super annoying but it actually does help someone that is learning to program in terms of teaching them to write code that is readable and if you are doing it in an IDE (which you should be if you are under the age of 50) you should be auto formatting every line you write anyways to see what indentation it is at.
... Copied to Clipboard!
SpiritSephiroth
07/06/21 7:08:49 PM
#59:


Atralis posted...
I support Python as a foot in the door language and then you move to something like C++, Java, or C# (Microsoft Java) for Data structures level stuff. IDE's help a lot with telling people "wait a second this type returned doesn't match this type you are expecting" as they are coding.

Thats exactly my plan. I want to move on to other languages after this.

---
... Copied to Clipboard!
SomeLikeItHoth
07/06/21 10:13:18 PM
#60:


kirbymuncher posted...
I'm not super great with python myself and I've mostly just learned from incrementally looking things up online so I can't really give specific book advice. just make sure you don't find something about python2
What languages are you most familiar with?

Also, here's a bunch of free Udemy courses I came across. You have to make an account, but it's ~$1,000 worth of courses for free.

https://www.reddit.com/r/learnprogramming/comments/oers8p/13_udemy_100_off_coupons_programming_courses/

---
FAM FOREVER.
... Copied to Clipboard!
SpiritSephiroth
07/07/21 10:36:55 PM
#61:


... Copied to Clipboard!
SpiritSephiroth
07/08/21 7:50:23 PM
#62:


Wasnt able to get much coding done today, focused on Japanese. Will definitely make up for it in the morning.

---
... Copied to Clipboard!
1337toothbrush
07/08/21 8:19:10 PM
#63:


... Copied to Clipboard!
SpiritSephiroth
07/08/21 9:28:52 PM
#64:


1337toothbrush posted...
Why not combine the two?

I had to make a presentation in not just Japanese, but Keigo Japanese. Got really confused and ended up spending the whole day doing that and chores.

Not to mention my girlfriend didn't really help out as she couldn't get around the fact that our sensei is teaching us Keigo way too early when we should be focusing on standard Japanese. Then she went to bed and didn't help much >_>

Edit: I was actually going to do some now but my head is shattered. I don't think I can process anything new right now.

---
... Copied to Clipboard!
SpiritSephiroth
07/09/21 6:15:58 PM
#65:


Finally finished all the tutorials I initially started, so doing small projects now.



---
... Copied to Clipboard!
1337toothbrush
07/09/21 7:03:09 PM
#66:


One thing you'll want to get used to is working with collections (e.g. lists, dictionaries). They help a ton with making your code more automated instead of dealing with contact1, contact2, contact3 like in your example.

Here is the same example you wrote but with putting the contacts into a list instead of individual variables: https://ideone.com/nGtsdl

As you can see, printing the objects out is a simple matter of iterating through a list. This is important when you start dealing in the hundreds, thousands, millions, etc of objects.

Here is the code in image form:


---
... Copied to Clipboard!
SpiritSephiroth
07/09/21 7:36:41 PM
#67:


1337toothbrush posted...
One thing you'll want to get used to is working with collections (e.g. lists, dictionaries). They help a ton with making your code more automated instead of dealing with contact1, contact2, contact3 like in your example.

Here is the same example you wrote but with putting the contacts into a list instead of individual variables: https://ideone.com/nGtsdl

As you can see, printing the objects out is a simple matter of iterating through a list. This is important when you start dealing in the hundreds, thousands, millions, etc of objects.

Here is the code in image form:

Thanks, this looks pretty useful, I'll save it.

---
... Copied to Clipboard!
SpiritSephiroth
07/10/21 8:51:50 PM
#68:


Got home pretty late but looked up a few bits of code I want to try tomorrow.

---
... Copied to Clipboard!
SomeLikeItHoth
07/11/21 3:40:06 AM
#69:


Here's ten more free (for a limited time) courses.

https://www.reddit.com/r/Python/comments/ohwtg7/udemy_10_100_off_coupons_programming_courses/

---
FAM FOREVER.
... Copied to Clipboard!
SpiritSephiroth
07/11/21 9:04:55 AM
#70:


SomeLikeItHoth posted...
Here's ten more free (for a limited time) courses.

https://www.reddit.com/r/Python/comments/ohwtg7/udemy_10_100_off_coupons_programming_courses/

Thanks man, got quite a few of them except two. These are totally free right? There are no monthly subscriptions or anything? I cant wait to get started on these!

---
... Copied to Clipboard!
SomeLikeItHoth
07/11/21 6:52:54 PM
#71:


SpiritSephiroth posted...
Thanks man, got quite a few of them except two. These are totally free right? There are no monthly subscriptions or anything? I cant wait to get started on these!
Totally free and you get them for life.

---
FAM FOREVER.
... Copied to Clipboard!
SpiritSephiroth
07/12/21 7:40:52 PM
#72:


SomeLikeItHoth posted...
Totally free and you get them for life.

Thanks again, will start on a course soon after I do a few projects myself. Still trying to wrap my head around the codes I've already learnt!

---
... Copied to Clipboard!
SpiritSephiroth
07/13/21 9:58:18 PM
#73:


Okay started the first course from Udemy but Im thinking to spend more time making my own projects as you guys said. Also I saw a Youtube video which suggested the same thing, as relying too much on tutorials wont teach you unless you practice. Same goes with everything I guess.

---
... Copied to Clipboard!
SomeLikeItHoth
07/13/21 10:45:52 PM
#74:


I've been learning about using APIs and collecting data. Right now I'm working on a storm tracker. Any good tutorials out there if I need help?

SpiritSephiroth posted...
Okay started the first course from Udemy but Im thinking to spend more time making my own projects as you guys said. Also I saw a Youtube video which suggested the same thing, as relying too much on tutorials wont teach you unless you practice. Same goes with everything I guess.
That's true. Much better to figure things out on your own. But mine as well get as many free videos as you can, just in case you need a break. I also recently discovered Python podcasts on my iPhone. I may start listening to those as well on my way to work / back home each day.

---
FAM FOREVER.
... Copied to Clipboard!
SpiritSephiroth
07/13/21 11:18:24 PM
#75:


SomeLikeItHoth posted...
I also recently discovered Python podcasts on my iPhone. I may start listening to those as well on my way to work / back home each day.

Oh really, who do you listen to? Does it help a lot without the visual component?

---
... Copied to Clipboard!
clyde_frog
07/13/21 11:36:55 PM
#76:


SpiritSephiroth posted...
Okay started the first course from Udemy but Im thinking to spend more time making my own projects as you guys said. Also I saw a Youtube video which suggested the same thing, as relying too much on tutorials wont teach you unless you practice. Same goes with everything I guess.

I literally just bought a shit ton of courses yesterday on Udemy (3 in Python, 1 in R and 1 in C++ to be exact). They had some amazing deals and Ive always wanted to learn how to program. Plus it will compliment my resume nicely.

---
... Copied to Clipboard!
SomeLikeItHoth
07/13/21 11:40:56 PM
#77:


SpiritSephiroth posted...
Oh really, who do you listen to? Does it help a lot without the visual component?
Haven't started listening yet, but I'm going to start with Talk Python To Me. Supposedly it's one of the better podcasts.

---
FAM FOREVER.
... Copied to Clipboard!
SpiritSephiroth
07/14/21 6:48:08 PM
#78:




Pretty sure I need to improve this code a bit since when running it, it doesn't work exactly the way I want it yet.

---
... Copied to Clipboard!
1337toothbrush
07/14/21 10:44:29 PM
#79:


In what way do you want it to work? I have a couple of simple modifications, shown in the image below:



First off, when you get the input from the user, set it to a singular letter case (upper or lower) so that you can make comparisons more easily (without the modification on line 13 above, a user typing "Yes" would have the program exit).

Second, you had this after the while loop:
if roll_again != "yes" or "y":
However, that is redundant since the while loop already checks that at the beginning of the loop every time. When it exits the loop, this condition will always be true.

Here is the link to the code snippet with modifications: https://www.ideone.com/agvENu

---
... Copied to Clipboard!
SomeLikeItHoth
07/14/21 11:58:07 PM
#80:


SpiritSephiroth posted...


Pretty sure I need to improve this code a bit since when running it, it doesn't work exactly the way I want it yet.
Here's how I ran it.

import random

roll_dice = True

while roll_dice:
print("Rolling the dice...")
print("The values are...")
print(random.randint(1, 6))

roll_again = input("Roll the dice again? (yes/no) ")
if roll_again == "yes":
roll_dice = True
else:
print("Goodbye!")
roll_dice = False

---
FAM FOREVER.
... Copied to Clipboard!
warlock7735
07/15/21 12:33:29 AM
#81:


It's not python, but I've been working on pulling down information from the dota api for a league I cast for. It's pretty interesting how many calls I need to make to get the right data, and how to chain /use callbacks to ensure things occur sequentially when gscripts isn't async

---
... Copied to Clipboard!
SomeLikeItHoth
07/15/21 6:14:48 PM
#82:


More coupons. First one didn't work for me, the others did.

https://www.reddit.com/r/learnprogramming/comments/oktcmx/udemy_11_100_off_coupons_programming_courses/

---
FAM FOREVER.
... Copied to Clipboard!
SpiritSephiroth
07/15/21 7:34:52 PM
#83:


1337toothbrush posted...
In what way do you want it to work? I have a couple of simple modifications, shown in the image below:



First off, when you get the input from the user, set it to a singular letter case (upper or lower) so that you can make comparisons more easily (without the modification on line 13 above, a user typing "Yes" would have the program exit).

Second, you had this after the while loop:
if roll_again != "yes" or "y":
However, that is redundant since the while loop already checks that at the beginning of the loop every time. When it exits the loop, this condition will always be true.

Here is the link to the code snippet with modifications: https://www.ideone.com/agvENu

Ah that makes sense! Thanks.

SomeLikeItHoth posted...
Here's how I ran it.

import random

roll_dice = True

while roll_dice:
print("Rolling the dice...")
print("The values are...")
print(random.randint(1, 6))

roll_again = input("Roll the dice again? (yes/no) ")
if roll_again == "yes":
roll_dice = True
else:
print("Goodbye!")
roll_dice = False

Will save this too! Thanks!

---
... Copied to Clipboard!
SpiritSephiroth
07/15/21 7:35:36 PM
#84:


SomeLikeItHoth posted...
More coupons. First one didn't work for me, the others did.

https://www.reddit.com/r/learnprogramming/comments/oktcmx/udemy_11_100_off_coupons_programming_courses/

This really helps, I appreciate it. Got quite a few of these courses so I can't say I'm lacking in material at all!

---
... Copied to Clipboard!
SpiritSephiroth
07/16/21 8:26:27 PM
#85:


Ugh didn't get anything done today. Was too damn hot and motivation was zapped.

---
... Copied to Clipboard!
SomeLikeItHoth
07/17/21 5:41:29 AM
#86:


SpiritSephiroth posted...
Was too damn hot and motivation was zapped.
You're going to start reaching your burn out period soon. It happens to all programmers. Just remember to fight through it.

---
FAM FOREVER.
... Copied to Clipboard!
SpiritSephiroth
07/17/21 9:06:46 PM
#87:


SomeLikeItHoth posted...
You're going to start reaching your burn out period soon. It happens to all programmers. Just remember to fight through it.

Yeah I deffo will. Doesn't help thats theres a huge heatwave here in London. 31 degrees tomorrow....

---
... Copied to Clipboard!
SpiritSephiroth
07/18/21 8:34:49 PM
#88:


Got it was BLAZING hot today, I managed to start a Udemy course and write some more practice codes at least.

---
... Copied to Clipboard!
1337toothbrush
07/19/21 3:56:51 AM
#89:


... Copied to Clipboard!
SpiritSephiroth
07/19/21 7:19:58 PM
#90:


1337toothbrush posted...
Do you not have air conditioning? RIP

Only in some offices. We dont usually have them in houses in London which is why its so hard for us to stand the heat.

---
... Copied to Clipboard!
SomeLikeItHoth
07/20/21 5:04:50 AM
#91:


SpiritSephiroth posted...
Only in some offices. We dont usually have them in houses in London which is why its so hard for us to stand the heat.
You could easily turn that into a Python project and create a map using matplotlib that shows the graphical data of the weather in London over the past week.

---
FAM FOREVER.
... Copied to Clipboard!
SpiritSephiroth
07/20/21 2:59:06 PM
#92:


SomeLikeItHoth posted...
You could easily turn that into a Python project and create a map using matplotlib that shows the graphical data of the weather in London over the past week.

Good idea man! I want to try that.

Right now, I'm making a text-based adventure game and I'm having so much fun. Im thinking of implementing some sort of Dungeons and Dragons mechanics or features in this once I learn more.

---
... Copied to Clipboard!
SomeLikeItHoth
07/21/21 6:33:25 AM
#93:


Spent 45 minutes trying to find out what's wrong with my code.

Not sure what's wrong yet but I know it's something stupid.

---
FAM FOREVER.
... Copied to Clipboard!
SpiritSephiroth
07/21/21 8:55:12 PM
#94:


SomeLikeItHoth posted...
Spent 45 minutes trying to find out what's wrong with my code.

Not sure what's wrong yet but I know it's something stupid.

Yeah, I know what you mean. Even though I'm still in the early stages, it feels so good figuring out how to do something in the end.

---
... Copied to Clipboard!
SpiritSephiroth
07/21/21 8:58:01 PM
#95:





This is the short adventure text story I made today. I'm not sure if this was the way to go about it, but I did it without looking anything up. I tried a lot of different code, and finally stuck to 'while' functions to make the code work.

I was able to create multiple different branches, and end the code whenever the story branch came at an end, or if an invalid input occured. One thing I forgot to do was to include the lowercase functions with the input. I might do that tomorrow, although I was thinking of focusing on Japanese tomorrow primarily.

---
... Copied to Clipboard!
Questionmarktarius
07/22/21 1:14:04 AM
#96:


while/else?
... Copied to Clipboard!
1337toothbrush
07/22/21 4:10:20 AM
#97:


This is about the point where you'll want to organize your code into functions and classes. Rooms should take a more structured form instead of being handled in one giant linear program.

Questionmarktarius posted...
while/else?

Python has a quirky else construct for while where it'll execute the else if you hit the while condition and it's false. Breaking out of the loop will skip it. When it hits the else, it'll only execute what's in that block once.

---
... Copied to Clipboard!
Questionmarktarius
07/22/21 4:12:27 AM
#98:


1337toothbrush posted...


Python has a quirky else construct for while where it'll execute the else if you hit the while condition and it's false.
I suppose that does simplify the if{while}else logic.
... Copied to Clipboard!
SomeLikeItHoth
07/22/21 7:41:18 AM
#99:


SpiritSephiroth posted...
Yeah, I know what you mean. Even though I'm still in the early stages, it feels so good figuring out how to do something in the end.
Spent another 30 minutes and finally figured it out! I forgot to put a @property (look this up) tag above one method and I made three other typos. So it was a combination of things. But now my code is working 100%. Just needed to do some trial and error.

SpiritSephiroth posted...
I'm not sure if this was the way to go about it, but I did it without looking anything up.
That's great. Now my suggestion to you would be to search how other people did something similar and compare it to yours. Here's one I did a few months ago.



---
FAM FOREVER.
... Copied to Clipboard!
1337toothbrush
07/22/21 9:48:40 AM
#100:


Alright, so I threw together a quick and dirty structured text adventure. Each room is its own function and the game runs in a loop with a win or loss condition. This allows you to jump back and forth between rooms and adding a room is simply a matter of writing another function and having one of the existing rooms simply "link" to that room by setting the state.

Here is the link: https://ideone.com/xFIwVn (You can see the execution here with sample input under stdin)

and here's the pastebin if you prefer that: https://pastebin.com/SAmvm6Fr

---
... Copied to Clipboard!
Topic List
Page List: 1, 2, 3