Tested time and calendar modules today, and created some of my own. The output on time module was odd, and I didn’t manage to get it to look sane. On Tutorials point there is a example of how to clean the time output, but that just looked really complicated way of doing it. Or then I just assume it must be easier.
Anyway, tomorrow I try to import my own modules from different file. Let’s see how that goes.
Looks like a can of Monster really is the fuel of the champions! I managed to make and import couple simple modules from other file, but that little more complex Animal class in moduletest.py does not work. Or then I’m doing someting wrong when trying to invoke it in my test1.py script.
Investigation shall continue tomorrow. My guess is this is yet again some stupid little mistake or typo somewhere…
Is it the tabbing? It seems to step out. I realise I have no idea how python lays out functions, it’s all Greek to me.
Suffice to say it cannot find the toString function, or one that matches what you called.
Thanks for the help, I really appreciate it! I looked into your suggestions but I didn’t manage to figure out what’s wrong.
I tried to tinker with indentation but I just got more errors. I try again tomorrow if that solves the problem. The Animal class is taken (with small modifications) from the Python youtube tutorial by Derek Banas. He has the code available on his website so I’ll look if there’s something I missed from the video.
I did create simple Person class in moduletest.py and was able to use that in my main test1.py script without any problems. That class does not have any methods, so like @khaudio said my methods in Animal class are broken.
So at least I have something to look into tomorrow.
Well today was a busy day. I didn’t even look at my code today, and managed to read some python stuff maybe 10 minutes. If I don’t fall asleep instantly I maybe read some documentation as a bedtime story for my self.
Hopefully tomorrow is a bit more productive day for me. Good night for now
Yesterday I got nothing done, but today was bit better day. I tested how reading and writing from files work and created two new .txt files to repo. test.txt was used for writing stuff to a file from python script and then reading it. readtest.txt was other test file for reading stuff. That piece of text is from Python Wikipedia page.
Not the most interesting update. Tomorrow I’ll take a look at how python reads input from user. I managed to read documentation a little bit and it looks like raw_input is deprecated from Python 3, and that could explain why I had problems with I/O in my earlier tests.
I use it mainly to test out some random one line scripts to see how they work. Anything more complex and I rather write the code to separate file and use Pycharms integrated debugger to see what happens.
Are you talking about the original Lisp? Like the one from 50’s? If I ever get anywhere with programming I’m definitely going to try some old programming languages just for fun.
Read a bunch of documentation and tutorials about functions in Python today, and now they start to make more sense to me. This far I’ve only used functions with the mindset of “well that’s how it is…”, without further thinking how methods and functions actually work.
Tomorrow I try to look into user I/O and hopefully I can then start to make that game. I have absolutely no idea where to start, but maybe I’ll just start to code the basic stuff and built from there bit by bit. That might force me to rewrite stuff but hey, it’s a learning experience!
That’s good, I think that’s what it’s generally designed to do. I learned Haskell that way. Write a function in a file, save, import in the REPL, play with function, rinse repeat.
Lol yeah I think they call it Modern Lisp or something now. The book that reads like a comic book is really good. Hits the ground running and gets you started.
Regarding your IDE of choice, I love JetBrains, but don’t be afraid to test some stuff out on CLI too (like creating your own env or installing packages with pip). It helps to ingrain the knowledge rather than relying on the IDE to do it for you.
I used to run my scripts on CLI at the begining, like: python3 foo.py, and wrote the code using VIM. Main reason why I use IDE for now is to be able to concentrate to programing, and let the IDE do all the nasty stuff behind the scenes.
I will give VIM another try later, but to keep things simple (and keep myself sane ) I will use IDEs for now.
Yet again I spent most of my time reading documentation and trying out some random small things. I also created new game.py and gmodules.py for the simple CLI game. Then I hit the wall and realized I have no idea where to start, meaning I haven’t planed at all how the game would progress and so on. So basically I was about to build a house, but I didn’t even know what kind of house I want to build.
So for tomorrow I will plan out the game, try to think out the basic functionality, etc.
Well sort of. I’m not actually sure what this will be. Actually, let me translate the main idea for the game I worked on the programming course I took while at the Uni:
In the game, you are able to create different player characters. Characters can have a profession, sell goods and services and engage in battle. Character starts from level 1 and after acquiring enough experience character will level up. To earn money, you must win a battle or sell goods. You may acquire a profession with money. Each character can have two professions. When you practice your professions, your skill level will increase and thus the quality the goods or services you provide will also improve. Once your character reached new level, the health and strength will also increase.
So that was the game idea in a nutshell. At first I was planning to follow that idea, but maybe I try to add my own twist to it.
It would also be fun to try to make pure text adventure game, but I’m not sure if I can keep up with multiple endings and so on.
Screw it, I’ll stop procrastinating now. Less talking and more coding!
Started coding the game, but didin’t get far and got buried under the not-so-helpful documentation. Tried to find out how to avoid extra space if I want to print variables: print('Hello', name, ", how are you doing?")
If I do it that way the output will be Hello Mike , how are you doing?, and I would like to avoid that extra space after variable. Tried the .format() but didn’t get it to work. I probably didin’t even use it right. Have to do some more research.
Other thing I briefly tired was the random number generator, but didn’t get that to work either. I only used maybe 10 minutes for trying to find solution for that problem so, meh, now I have something to do for tomorrow.
Thanks! I tired to figure out that problem on my lunch break at work today, but it didn’t work. I have a feeling the problem is my string is a variable, and that variable is the one that by default adds white space after it. I have to do more research tomorrow.
I did get the random generator to work, so some progress at least. Well, three lines of code…