Return to Level1Techs.com

Devember - Relearning to program using Python

devember2k18

#10

Thought my “planing stage” for Devember could be looking into Vim and Git, so I decided to create .vimrc file just so that I can have line numbers at startup. Ended up playing around with Vim controls for a moment. It’s not that bad once you get used to it, but let’s see if this sensation will last once I actually try to code something.

But hey, I have line numbers now when Vim starts. Yay! :tada:

And I didn’t start coding yet, that’s just the html file for my Firefox start page I stole made many moons ago.

I should have a free evening tomorrow after work so I’ll see if I can get GitHub repo up for Devember. I’ll edit the OP and add the link to the repo if/when it’s up.


#11

The best of luck!

I didn’t know that tutorial you linked yet. I’ll have a look at that :slightly_smiling_face:

That sounds awesome!! I would totally play that game. :sunglasses:


#12

Cool, I think Python is a good thing to learn these days. You can do quite a bit with it. It has some powerful libraries. You could quite happily program a Raspberry Pi with it. You could even utilize MicroPython to get some micro-controllers doing things.
I have tried to learn it several times, but have never used it to do anything, so all gains lost so to speak. Good Luck!


#13

i will be lurking on this as i need to learn python myself for reasons


#14

Thanks!

Don’t expect too much tough, this is going to be basic… python…

Thanks! I actually have 3 raspberry pis and some Chinese arduinos collecting dust atm.

Welcome :slight_smile:


#15

How did you put it again?

:wink:

The idea on it’s own is interesting. No matter what, I would try it. :+1::sunglasses:


#16

Aaand now I have repository up. Took some time to figure how to use Git from Linux terminal, my previous repo was created using GitHubs own desktop app. :smiley:

I still don’t quite understand different branches etc., but those probably start to make sense eventually. And I tbh don’t see any need to move away from the “master” branch since this repository mostly acts as a backup and public share of my devember adventures.

I’ll spend the rest of the evening playing around with Git commands and see how this stuff actually works.


#17

donotreadme huh? :wink:


#18

By the emperor the typos are real. No wonder why none of my python attempts work.

So:

Day 1

  • Figured out how to run my python scripts/files in terminal
  • print("Hello world") worked, all else that I tried did not
  • Got frustrated, drank a can of Mountain Dew
  • Tried again, still nothing works

But on a positive note I found my old notes and assignments for the “Object-oriented programming” - course. The course main assignment was to create World of Warcraft - clone. Yea I think my teacher did like that game… :smiley:

I’ll take a look into that assignment and try to translate it into English later and post short version of it in here. I think that would be good basis for my awful epic cyberpunk game.

That is, if I ever get these "@%&#* if-else loops to work. :angry:


#19

So basically my day 1…
Don’t give up. Day 2 will be WAY better.


#20

This is the point where I would gladly offer my help. The problem is that I am not very good at reading code, but I can try. :wink:

I got very frustrated with dependency issues today, so even worse on my end :thinking:


#21

Thanks! I did get the thing working eventually (second.py in repo once I push it). Turned out the tutorial had a mistake in it! Tried to use input to read user input, but the right one was raw_input.


#22

oh, that’s indeed frustrating.

well, a new day brings new luck :slightly_smiling_face:


#23

Don’t overdo it day 1… You need to have steam in the engine for 30 more days.


#24

Kinda late for resource, but I just found this out yesterday, so yee…
Berkeley: https://cs61a.org/ (Python course video and book tutorials by the one and only)
Edx: https://www.edx.org/ (search python, but can give you any college courses you desire)
FreeCodeCamp: https://www.freecodecamp.org/ (not python, but gives you a certification for each course you complete)
Derek Banas: https://youtu.be/N4mEzFDjqtA (Learn Python in one video!)


#25
if num == int:
	print("Was your number", num)
else:
	print("Please try again")	

I don’t think you can directly compare the variable to a type. You should be able to do this:

if type(num) == int:
	print("Was your number", num)
else:
	print("Please try again")

#26

Thanks! I’ll take a look into those resources.

@ArgGrr yeah that piece of code came straight from my head after reading tutorials for 30min. Just wanted to test out how variables work in python, and weeell it was not as simple as I thought. Decided to just bite the bullet and follow the tutorials bit longer before going all out. :smiley:


#27

Are you building the scripts and executing them? It can be handy typing stuff directly into python command line, like this, to test stuff out:


#28

I write the scripts with Vim and then just execute them with python blabla.py

I noticed that stuff can be typed directly to python compiler or prompt or, idk. But yea for some reason it didn’t occur to me to type commands and test things out that way. I might as well do that! Thanks! :slight_smile:


#29

Day 2

Didn’t do any actual coding, at least not yet. I spent the time reading tutorials and figuring and testing stuff out. There’s still couple hours left for this evening so let’s see if I get some stuff done.