Jump to content

Photo

Learning Python


  • Please log in to reply
26 replies to this topic

#1 Anthus

Anthus

    the wild-eyed boy from freecloud

  • Forum Moderators
  • Gender:Male
  • Location:Please turn on high-accuracy mode

Posted 17 July 2018 - 04:32 PM

Since June 30th, I've been trying to set a side a chunk of time each day to learn Python. It has been going well so far, and I am learning, and retaining concepts. I'm even able to look over some scripts here, and identify parts of it that I was unsure of before, such as functions, arguments, commands, and variable manipulation.

 

I just wanted to make a thread to see what kinds of languages people here know, and what kind of advice you'd have for someone getting into programming. This is something I plan on sticking to, and taking seriously. I'm not sure what will come of it, but I'm hoping to be able to make stuff within a year. I've made a few small things, but they are pretty basic, and just following a tutorial.

 

Where did your programming adventure start? What kinds of things helped you learn? What kinds of challenges have you encountered?



#2 Zacron

Zacron

    Wizard

  • Members
  • Real Name:Zachery
  • Gender:Male
  • Location:Inwood, WV

Posted 17 July 2018 - 04:51 PM

I'm a programmer by trade these days, focusing on web apps, but dabbling in all sorts of stuff.

 

On a near daily basis, I use PHP, HTML, CSS, JavaScript, MySQL, and several specific libraries built on each of those.

 

I've actually been doing a lot with Phaser 2.10, which is a JS Library built for making 2d games that run pretty much anywhere.

 

As far as python goes, it's a fun language, and shockingly powerful when it needs to be. I wrote a number of different programs in it, and I really like it.

 

One program I would direct you to is PyCharm Edu.

 

It is a full (and free) IDE built for Python, but has tutorials and lessons built in.

 

My very first memory of programming was in the 90s when I found a version of Visual C++ 6.0 on a disk of my grandfathers. I was immediately curious about it, but never had the focus to do anything with it until almost 20 years later. Since then, I took every programming course I could in school, and then kept the education going with udemy.com.

 

My only real challenge with programming is focus. I have some chemical disorder which (alongside my depression) makes it hard to focus for longer than a few minutes at a time. Once I actually get the focus I need, though, I can pretty much knockout whatever task is set before me.

 

If you are interested, I can direct you to some specific resources that really helped me out. :)


  • ShadowTiger and Anthus like this

#3 klop422

klop422

    Evil Crazy Mastermind

  • Members
  • Real Name:Not George
  • Gender:Male
  • Location:Planet Earth

Posted 17 July 2018 - 06:27 PM

I've only really done programming in school (mostly True Basic Silver, though a little of Visual Basic as well), but I'm apparently going to be learning python next year as well as part of my Practical Physics course (including 'introduction to functions' - having worked with all sorts of functions and modules in True Basic, that makes me laugh). My issue with learning programming is that it's something I can only do in my free time, and when I already have all sorts of other things I want to do in my free time (writing all sorts of music at the moment), that's not something I'll end up doing.

That said, I do really enjoy programming when I do it, and, honestly, so far (though I've only done school assignments), I haven't had too many issues with it.

By the way, if you're wondering why we'd be learning programming in Physics, I believe it's for simulations. Not that we're doing any important simulations in second year, but it's all about building up skills for later life.

 

Good luck in your Python adventure. I hear it's one of the better (or at least more popular) ones, and that it's not broken in some way or another (like java allegedly is).


  • Anthus likes this

#4 MarinaraSauce

MarinaraSauce

    Magus

  • Members
  • Real Name:Grant
  • Gender:Male
  • Location:New York

Posted 17 July 2018 - 06:32 PM

I'm a software engineering major right now, and I know Java really well and some Python (and I'm just starting to learn C). My recommendation is to learn more languages than just Python if you plan to make something large-scale, as it's really best for small-scale projects. A lot of people will tell you that Python is a "bad" language or a "teaching" language, which I disagree with, but it is a matter of having the right tool for the right job.


  • Anthus likes this

#5 NoeL

NoeL

    Remilia looks better with grey/green hair.

  • Members
  • Real Name:Jerram
  • Gender:Male

Posted 17 July 2018 - 08:35 PM

I started "programming" with Multimedia Fusion. After that I learned Visual Basic in high school and Java, JS, PHP, XHTML, CSS, SQL, AS and C++ at uni. Since then I've dabbled with a few game engines - SDL for C++, Love for Lua (which I quite liked!), and I've recently jumped into GML for Game Maker (I've generally stuck with Clickteam for game dev but after a short foray into GM I think I'll make the switch. With the amount of coding I do it seems much easier to write a script than have the code all broken up into events.


  • Anthus likes this

#6 David

David

  • Forum Moderators
  • Real Name:David
  • Gender:Male

Posted 17 July 2018 - 08:43 PM

I first became interested in programming when I started using ZQuest, actually. While at first I simply used the program's features, I soon found out about ZScript and made the effort to learn it as best as I could. It was tough at first, but after looking through tutorials and other people's scripts, I would start to understand it until I reached a point that I could start writing simple stuff, which eventually progressed into more complex scripts. I think what helped me the most here was looking at other people's scripts. I would break the script down as best as I could and try to understand every line to see what it does. By doing this, I learned how good scripters pieced together their code effectively while learning the more particular stuff of programming languages such as syntax, class/function names, and how to use loops, strings, arrays, etc.

 

Sometime when I was learning ZScript, I also had the opportunity to take a programming class during my senior year in high school. At that point I was fascinated with ZScript and wanted to learn more about programming, so I decided to attempt AP Computer Science. I had an amazing teacher and it was a wonderful experience. In this class, they teach you Java, which is a pretty useful programming language to start with for learning. The teacher did a very good job of providing applications to what we were learning. You can only go so far with reading about programming languages; you also have to apply your skills and try to make stuff for yourself. One of the big things that helped me was to constantly practice what I was learning. There were many resources online that I used to help me with this in particular.

 

I am now in college and am double majoring in both Biochemistry and Computer Science. On top of Java, I have also learned C, C++, and even some Assembly, and my future classes will teach me even more programming languages. I'm not sure if I'll learn Python at some point, but once you know and master some programming languages it becomes easier to learn other ones, so I could take it up at some point. It's useful to have such versatility in the programming languages you know because some of them are more useful for certain, specific tasks. I still love programming, and I can't wait to keep learning more and more as time progresses.

 

As a summary for pointers: Don't give up and keep at it. Computer science is not always easy, and certain problems pose great challenges to even the most experienced programmers. It can be difficult to grasp at first, but if you keep at it you will eventually understand it. The important thing is to practice, practice, practice. There are many resources online that give you practice problems for which you have to write some code, and then they run test cases to check your code to see if it is correct. This helped me tremendously to learn the basic fundamentals of programming such as loops, arrays, etc, which are needed in order to progress into more complicated program creation. CodingBat was one I used frequently (they have problems for both Java and Python, though more for Python), but there are many more available online. Other things you can do is look for YouTube videos or other sources of information on certain topics. The Internet has so many resources to help you learn so be sure to take advantage of it when you need it.


  • Anthus likes this

#7 Saffith

Saffith

    IPv7 user

  • ZC Developers
  • Gender:Male

Posted 17 July 2018 - 10:38 PM

My parents got me a couple of André LaMothe's game programming books when I was a kid. I still have them, but they're interesting artifacts more than useful guides these days. Didn't seriously get into programming until college, though. These days, I'm mostly just doing C++, some Lua for PICO-8, and then the product I deal with at work has its own language.

All my advice is more long-term stuff. :P

It's important to understand that when you get beyond the basics, programming is more about design and logic than code.
You probably don't need them yet, but learn about design patterns at some point (Singleton's frowned upon nowadays, but everyone still includes it...). And here's a good book (with a free web version) on design patterns in games.
You can find a lot of programmers talking about design on their blogs. It can be quite educational, but there are also a lot of conflicting opinions for various reasons. Different people and different projects have different priorities, some techniques might work better in some situations or some languages than others, and sometimes people are just plain wrong about things. Still, it's worth looking around to see different ways of doing things and what the tradeoffs are.

Don't make the mistake of thinking object-oriented design is all about inheritance. It's about division of responsibilities, sensible abstractions, and programming to interfaces. Inheritance is just a means to those ends. Object-oriented languages are designed around object-oriented design concepts, but a lot of people don't seem to understand that making use of those concepts without considering the principles they're meant to enable doesn't constitute object-oriented design. Sometimes you hear people make comments along the lines of "the object-oriented way to do this would be just to make a bunch of subclasses." What they're complaining about isn't really OOP, but simply bad design, and generally even contrary to object-oriented design principles.

Methods and priorities do vary, but making things easy to change is always important. If you change how something works, you don't want to have to update everything that depends on it. If you add a new feature, you don't want to have to redesign your whole program to accommodate it. It takes a while to learn what that really means, but ZC's a great example of why it's so important. When the item editor was added in, hundreds of bits of code that dealt with items had to be updated, and we had years of random crashes before they were all sorted out. Same thing when the enemy editor was added, and suddenly there was no telling what might be playing a given sound or what might have created a given weapon. And there's the ongoing matter of updating it to newer libraries and requirements, which is nearly impossible because so much of the code depends on the palette, the resolution, and Allegro 4.

And don't be dogmatic. Programmers tend to think their own ways of doing things are right and everyone who disagrees is objectively wrong, and it annoys the hell out of me.

(Okay, I suppose most of my "advice" is just ranting about things that bug me. :P)

Edited by Saffith, 18 July 2018 - 12:48 PM.

  • Anthus and David like this

#8 Jamian

Jamian

    ZC enthusiast

  • Members
  • Gender:Unspecified

Posted 18 July 2018 - 04:54 AM

As others have said, if you're serious about programming, try and learn different languages. Once you've grasped the general logic, learning a new language will become steadily easier.

 

As a useful language that resembles ZScript, I recommend C/C++.


  • Anthus likes this

#9 Anthus

Anthus

    the wild-eyed boy from freecloud

  • Forum Moderators
  • Gender:Male
  • Location:Please turn on high-accuracy mode

Posted 18 July 2018 - 06:54 PM

Whoa, lotsa replies. I figured a lot of people here had some grasp on some form of programming.

As for what has been suggested, everything makes a lot of sense, and some is stuff I already considered like (eventually) learning other languages. I have a friend (well, he's more of my dad's friend, but still) who works as a professional programmer. I'm not sure who he works for at the moment, but he, like me, started learning when he was 28 after being sick of basically floating from dumb job to dumb job. He is now 41, and makes six figures a year. Now, I know that isn't everyone, but that is a nice prospect. And I'm not trying to get rich or anything, I just want to learn this stuff, and maybe get a job in the field.

He suggested that I learn SQL as well, if I wanted to go towards web design, and building applications and stuff. He also uses C++/ C#, Java, and Python. I know he worked for AT&T a while, but quit cause according to him, their platforms are "bass akwards as fuck, and from like 20 years ago".

As much as I want to learn programming to make muh gaem and bring muh OC to life, I think I should focus on wider focused, more practical applications, and work on game stuff on the side. Tbh, right now, even making just 30-40K a year would be nearly double what my broke ass currently makes. And nope, I'm not afraid to talk about how broke I am :P

Edit: And Saffith, I agree with the dogmatic thing.
  • peteandwally likes this

#10 ZoriaRPG

ZoriaRPG

    The Timelord

  • ZC Developers
  • Gender:Unspecified
  • Location:Prydon Academy

Posted 19 July 2018 - 02:21 AM

I started with MLs for 6800, 6809, 65xx and similar, and moved forward to Cobol, Fortran, and Pascal.

I still use Pascal to this day, albeit in its modern form (specifically FreePascal), and SQL, Perl and some others that are critical to IS.

I use C/CPP, regularly, because ZC is coded in C++03.

What are your goals?

I'll admit that I do not care for Python, and my disdain stems from how Python sees BEGIN and END tokens.

Let's look at some examples:

Using Pascal:
 
var
a: Integer;
s: String;

a := Random(5)+2;

if ( a > 2 ) 
begin
	s := 'Above two';
end
else
begin
	s := 'Two or less';
end;
In C++:


int a;
char s[15];

a = rand()%(5-3) + 2;

if ( a > 2 )
{
	string s1 = "Above two";
	strcpy(s, s1.c_str());
}
else
{
	string s2 = "Two or less";
	strcpy(s, s2.c_str());
}
In each of these examples, the beginning and end tokens for the statements are explicit.

If you remove the indentation, intentionally, or accidentally, they still operate in the same manner.

Let's look at a trickier example:

 
int a;
char s[15];

a = rand()%(5-3) + 2;
int b;

if ( a > 2 )
{
	string s1 = "Above two";
	strcpy(s, s1.c_str());
	if ( a > 4 ) 
	{
		b = a*a;
	}
}

else
{
	string s2 = "Two or less";
	strcpy(s, s2.c_str());
}

Here's the same code, without indentation:




As you can see, it's harder to read and follow, but you can still clearly determine that the else belongs to the first if statement, not the second.


As I don't recall how to use strings in Python at present, I'll give a short example of the issue that I have with its syntax:
 
a,b = random.randint(2,5),0
if a > 2:
	if a > 4:
		b = a * a
else:
	b = a * 2
Let's remove the indents now.
 
a,b = random.randint(2,5),0
if a > 2:
if a > 4:
b = a * a
else:
b = a * 2
 
To which if statement does the else statement belong? In the first example, it clearly belongs to the first if, but after stripping the indentation, it now belongs to the second if.
 
Perhaps there is some way to avoid this catastrope, but I'm not aware of it. I ran into it a few times when a web UI stripped the formatting out of a code block, and turned it into a mangled mess.

In a language with explicit begin and end tokens of some kind, it's possible to reconstruct the intent. Without those, the intent dies a painful, agonising death.


Python does have some good stuff, but I'm not a fan of its syntax in general. The loss of scope is just the icing on the cake, for me.


Again though, it depends on what you want to accomplish: It's a good idea to determine what best fits the task at hand.

SQL is probably the best-paying.


Another tip:

Learn C99 before you waste gobs of time on C++11.

[...]And don't be dogmatic. Programmers tend to think their own ways of doing things are right and everyone who disagrees is objectively wrong, and it annoys the hell out of me.
[...]


That's the absolute truth. I think that most of us end up as grumbling old buggers who think our way is the highest science.


I started "programming" with Multimedia Fusion. After that I learned Visual Basic in high school and Java, JS, PHP, XHTML, CSS, SQL, AS and C++ at uni. Since then I've dabbled with a few game engines - SDL for C++, Love for Lua (which I quite liked!), and I've recently jumped into GML for Game Maker (I've generally stuck with Clickteam for game dev but after a short foray into GM I think I'll make the switch. With the amount of coding I do it seems much easier to write a script than have the code all broken up into events.



I saw VB in most of the posts here. Why the heck is MSVB the first language that's being taught these days?!

It's never useful in any sense, for any kind of professional programming, and its elements don't carry over very well to other stuff.

I understand why they teach Java, which IMO, is awful.

To be honest, courses should start with simple C concepts, and perhaps a bit of Perl. The practices that people pick up when learning Java are why most programmers who start with Java write such utterly deplorable code.

Java is an over-rated, pile of doo-doo, and it has strayed so far from its original purpose that the very idea of it disgusts me. Absolutely everything for AndroidOS is coded in Java, and thus is extremely wasteful, and bogged down with nonsense.

I understand that it's portable as heck, but that is a gigantic trade-off in terms of performance, memory use, executable size, and other factors.

Further, apparently, universities are starting students off with stuff like Macromedia Actionscript, and Lingo. Honestly, WTF?

Why not teach HyperCard, while you're at it. :/
  • Anthus likes this

#11 klop422

klop422

    Evil Crazy Mastermind

  • Members
  • Real Name:Not George
  • Gender:Male
  • Location:Planet Earth

Posted 19 July 2018 - 07:07 AM

In Scotland, the SQA (Scottish Qualifications Authority, i.e. the national exam board) has a thing called HAGGIS, which is a little stricter than pseudocode. I'd love to see someone turn it into a proper working language for the lols. Would be awful and funny at the same time.

Also, the fact that the examinations allow you to use any language you want (a good thing in one sense, since it means they're not favouring on language over any other) as well as HAGGIS means that one should, hopefully be allowed to write programs in INTERCAL or Brainfuck (though they do have rules against 'crass or offensive language', so naming the latter might be an issue).

 

I believe after I left high school (i.e. last year) they've started using Python instead of either True Basic or Visual Basic - not entirely sure which one they're replacing.

Also, I don't know about Visual Basic being completely useless - I think SMBX back in the day was written with Visual Basic. That's not to say that it is very useful in the contexts I presume you meant - i.e. professional contexts. Also, that doesn't mean it's any good either. Just a thing that was made with it.



#12 peteandwally

peteandwally

    chiubicabachiukicaca

  • Members
  • Gender:Unspecified

Posted 20 July 2018 - 07:47 AM

If you're just starting out, I suggest this report from stack overflow.

 

My first programming experience was in html, then some MATLAB during school, then C++ and Python with a bit of Java. In all, I always try to make a simple game (even in MATLAB) when learning something new because getting a running game forces you to understand how to show users information and process input. For Python, I used the libTCOD library and this tutorial. Then, as I understood python more, I could write my own functions instead of relying on a library. You might find some other cool stuff on Tigsource.

Now I mainly do image processing and mobile apps, but coding is all in my spare time rather than a job. My classes rely on things like CAD (Solidworks), Altium (circuitboard design) and microcontrollers (Arduino). That's more software, but if you ever want to get into making things, I'd look into those to support hardware dev and use your favorite coding language to write corresponding software.

Coding on its own is unappreciated, but when you do something else for work AND you can code, that is very powerful. The exception is in health informatics right now. If you can analyze big data using python and a few GPUs, you can find a nice job. Good luck and happy coding!

 

~PnW


Edited by peteandwally, 20 July 2018 - 07:49 AM.


#13 Zacron

Zacron

    Wizard

  • Members
  • Real Name:Zachery
  • Gender:Male
  • Location:Inwood, WV

Posted 20 July 2018 - 09:53 AM

My parents got me a couple of André LaMothe's game programming books when I was a kid.

 

Teach yourself Game Programming in 21 Days???

I had that one as a kid (Still have the disc), and bought it again on Amazon for .99 (with 3.00 shipping, lol).

 

That is really a great book!



#14 Saffith

Saffith

    IPv7 user

  • ZC Developers
  • Gender:Male

Posted 20 July 2018 - 10:17 AM

Nah, I had the "Tricks of the Game Programming Gurus" books. There are bits that are still relevant, like stuff about 3D rotation and ray tracing, but they're mostly out of date.
 

Now is a really great time to be in the video-game business. Unlike a couple years ago, we can today count on a few common denominators that we couldn't before. For example:

  • Most people have a 386 or better.
  • Most people have at least VGA graphics, with a large percentage of game players owning sound cards.
  • Finally, with Bill Gates at the helm of Microsoft, we can almost bank on most people having a mouse—because almost everyone owns a copy of Windows.
So, yeah. Slightly old.

#15 dinosaur rhombus

dinosaur rhombus

    bepis

  • Members
  • Real Name:Earl
  • Gender:Male
  • Location:a chair

Posted 20 July 2018 - 03:03 PM

I have a crusty discord bot written in Python.

 

https://discordapp.c...=3072&scope=bot

 

It literally just catches messages into text files and spits them out every X amount of lines in chat. Can't really say its a useful use of Python but it does something.


  • Anthus likes this


0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users