Page 1 of 2

New Python Projects

Posted: Fri Apr 17, 2015 2:16 am
by mac
I'm in here looking for some ideas for how I can broaden my Python abilities. I know pretty well the concept of memory variables, and I was even messing around in an interpreter creating small functions (like returning a value or something).

How could I broaden my knowledge with small projects to work on. By the way, I decided to go with the learn as you create route here on.

Re: New Python Projects

Posted: Sat Apr 18, 2015 3:06 am
by KemyLand
Although OSDev.org is not the appropiate forum (maybe it's okay in General Programming?), you may want to start with something like this by the moment. I can't provide too much help until you get into basic OSDeving.

Re: New Python Projects

Posted: Sat Apr 18, 2015 5:39 am
by Muazzam
Try to calculate the value of Pi using leibniz's series.

Re: New Python Projects

Posted: Sat Apr 18, 2015 5:45 am
by KemyLand
muazzam wrote:Try to calculate the value of Pi using leibniz's series.
Nah, if he doesn't know Leibniz's series he won't know how to do it. After all, this is about programming, not math (related, but doing the later will distract him from the real objective). BTW, doing that is too easy.

Re: New Python Projects

Posted: Sat Apr 18, 2015 5:47 am
by Muazzam
What about creating an (artificial (user-mode)) operating system in Python? (OSDev+Python)

Re: New Python Projects

Posted: Sat Apr 18, 2015 5:49 am
by KemyLand
muazzam wrote:What about creating an (artificial (user-mode)) operating system in Python? (OSDev+Python)
That's good :D and introduces him to the matter.

Re: New Python Projects

Posted: Sat Apr 18, 2015 5:51 am
by KemyLand
BTW, for the sake of completeness, an example, possible code for calculating Pi using Leibniz's series would be:

Code: Select all

x = 1
add = False
denom = 3
for i in range(32): # Change this if you want more or less precision
  if add:
    x += 1.0 / denom
    add = False
  else:
    x -= 1.0 / denom
    add = True
  
  denom += 2
print x * 4

Re: New Python Projects

Posted: Sat Apr 18, 2015 10:37 am
by iansjack
I think it would be more accurate to say that that is one possible way of coding the solution, rather than saying it is the code. It's a rather inefficient and wordy solution, not one that I would like to see used, but it certainly works.

Re: New Python Projects

Posted: Sat Apr 18, 2015 11:13 am
by KemyLand
iansjack wrote:I think it would be more accurate to say that that is one possible way of coding the solution, rather than saying it is the code. It's a rather inefficient and wordy solution, not one that I would like to see used, but it certainly works.
Well, my Python code has never been too Pythonic and/or short. Now editing the post according to your observations.

Re: New Python Projects

Posted: Sat Apr 18, 2015 6:28 pm
by mac
muazzam wrote:What about creating an (artificial (user-mode)) operating system in Python? (OSDev+Python)
Do you mean like simply printing a prompt to the screen?

Re: New Python Projects

Posted: Sat Apr 18, 2015 6:31 pm
by cmdrcoriander
SeanMc wrote:
muazzam wrote:What about creating an (artificial (user-mode)) operating system in Python? (OSDev+Python)
Do you mean like simply printing a prompt to the screen?
I'm not 100% sure what muazzam meant but I think the idea of creating a shell in Python would be a really fun little project to get started with - something that prints a prompt out and lets you start other programs, explore the filesystem, etc :)

Re: New Python Projects

Posted: Sun Apr 19, 2015 1:25 am
by Muazzam
SeanMc wrote: Do you mean like simply printing a prompt to the screen?
I meant a shell and OS with a way to start programs, an API, a 'new' file system (yes, it is also fun), as well as, if you like, a multi-tasking kernel (scheduler), (software) virtual memory. If you like, you can also create a text editor for your OS, emulator for running other OSs and maybe a graphical interface (GUI).

Re: New Python Projects

Posted: Sun Apr 19, 2015 2:59 am
by cmdrcoriander
muazzam wrote:
SeanMc wrote: Do you mean like simply printing a prompt to the screen?
I meant a shell and OS with a way to start programs, an API, a 'new' file system (yes, it is also fun), as well as, if you like, a multi-tasking kernel (scheduler), (software) virtual memory. If you like, you can also create a text editor for your OS, emulator for running other OSs and maybe a graphical interface (GUI).
That's a bit extreme for someone who is 'messing around with functions in the interpreter' I think :P

Re: New Python Projects

Posted: Sun Apr 19, 2015 11:16 pm
by mac
That is impossible with Python isn't it?

Re: New Python Projects

Posted: Mon Apr 20, 2015 1:52 am
by iansjack
Python can implement this quite easily, but I think it is a ridiculously over-ambitious project for a beginner.

For the time being I would stick to simple things, perhaps a few basic games (e.g. the traditional "guess a number game"). You must surely be able to think of things to program - if not, what is your motivation to learn in the first place?