r/learnpython • • Jun 09 '20

Github as a beginner

As a beginner learning python, is it too early to create and start coding simple projects on Github. and how do I transfer these codes (simple calculators) to a website I build subsequently?

401 Upvotes

111 comments sorted by

View all comments

25

u/SirMarbles Jun 09 '20

I usually put my finished projects on it.

https://github.com/SirMarbles/

It’s a good way to see your progression as a programmer

16

u/CaptSprinkls Jun 09 '20

I have been off and on learning programming ever since I graduated college. About 2 years ago I sat down and decided to learn C++. My first application was a tic tac toe game. I shit you not, it was 1000 lines of code.

Sad times....

3

u/SirMarbles Jun 09 '20

I’m a CS major. If you don’t mind. Can I see the code? The next language I want to dabble in is C++.

11

u/CaptSprinkls Jun 09 '20

Oh, this is definitely not something you want to look at it you want to learn C++. I'm pretty sure a tic tac toe game can be done in like ~50-75 lines of code. Q

I got to 1,000 lines because I just did huge nested if statements.

7

u/thirdegree Jun 10 '20

I got to 1,000 lines because I just did huge nested if statements.

Ah, you wrote an AI.

2

u/SirMarbles Jun 09 '20

Ahh gotcha. Never looked at C++ code. I assumed it’s just hard to code in from your example

7

u/QbaPolak17 jwlodek Jun 09 '20

As someone who writes C/C++ professionally, you can usually make your programs fairly succinct (not as much as python but that is hardly surprising). u/CaptSprinkls is right that you could make a tic tac toe game in probably ~100 ish lines of code. Problem with C++ and C is that if you don't know certain concepts, pointer arithmetic in particular, and if you don't follow best practices the code can quickly get away from you. When I first learned C at University, my first ever project I did the same thing and didn't follow best practices and had this 600 line monstrosity that I could now write in about 50 lines.

4

u/SirMarbles Jun 10 '20

You know any good sources to watch or read to get a head start on my class next semester?

What would you compare C/C++ to? I’ve learned Java, Js, kotlin, python.

4

u/u38cg2 Jun 10 '20

C and to a lesser extent C++ are verbose assembly language, meaning they are very close to the metal your code runs on. Visually it shares a lot with Java.

I wouldn't worry too much about getting across it, but what I would do is translate a few projects you've already done into C[++] and get to know how the language bites you and how to debug it.

1

u/SirMarbles Jun 10 '20

Ahh true. I remember reading that a few months ago. Thank you. Time to learn the basics.

1

u/tradrich Jun 10 '20

u/u38cg2 suggestion is good in my opinion. I would add that you should study the most recent C++ coding guides, because the newest C++ is a big delta from the previous, which is a big delta from the ones before (even though they're backward compatible).

The C++ 20 idioms are the most expressive and supersede earlier good practice - this can be very confusing to a beginner.

2

u/OnlySeesLastSentence Jun 10 '20

Reminds me of the first time I wrote a connect 4 program (and best of all, it required you to be honest and take care of gravity lol).

I didn't have a plan for how to do the win cases, so I copy pasted every possible combo for a win, changing the values by one as needed. I think it was 13,000 lines in the end? Or maybe 1300, I dunno.

1

u/[deleted] Jun 10 '20

Like from top to bottom Choose Your Own Adventure style, the thing we have to avoid today and use Object Oriented Programming instead right haha.