New Python Projects

Programming, for all ages and all languages.
mac
Member
Member
Posts: 144
Joined: Tue Sep 23, 2014 6:12 pm

New Python Projects

Post 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.
User avatar
KemyLand
Member
Member
Posts: 213
Joined: Mon Jun 16, 2014 5:33 pm
Location: Costa Rica

Re: New Python Projects

Post 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.
Happy New Code!
Hello World in Brainfuck :D:

Code: Select all

++++++++[>++++[>++>+++>+++>+<<<<-]>+>+>->>+[<]<-]>>.>---.+++++++..+++.>>.<-.<.+++.------.--------.>>+.>++.
[/size]
User avatar
Muazzam
Member
Member
Posts: 543
Joined: Mon Jun 16, 2014 5:59 am
Location: Shahpur, Layyah, Pakistan

Re: New Python Projects

Post by Muazzam »

Try to calculate the value of Pi using leibniz's series.
Last edited by Muazzam on Sat Apr 18, 2015 5:46 am, edited 2 times in total.
User avatar
KemyLand
Member
Member
Posts: 213
Joined: Mon Jun 16, 2014 5:33 pm
Location: Costa Rica

Re: New Python Projects

Post 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.
Happy New Code!
Hello World in Brainfuck :D:

Code: Select all

++++++++[>++++[>++>+++>+++>+<<<<-]>+>+>->>+[<]<-]>>.>---.+++++++..+++.>>.<-.<.+++.------.--------.>>+.>++.
[/size]
User avatar
Muazzam
Member
Member
Posts: 543
Joined: Mon Jun 16, 2014 5:59 am
Location: Shahpur, Layyah, Pakistan

Re: New Python Projects

Post by Muazzam »

What about creating an (artificial (user-mode)) operating system in Python? (OSDev+Python)
User avatar
KemyLand
Member
Member
Posts: 213
Joined: Mon Jun 16, 2014 5:33 pm
Location: Costa Rica

Re: New Python Projects

Post 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.
Happy New Code!
Hello World in Brainfuck :D:

Code: Select all

++++++++[>++++[>++>+++>+++>+<<<<-]>+>+>->>+[<]<-]>>.>---.+++++++..+++.>>.<-.<.+++.------.--------.>>+.>++.
[/size]
User avatar
KemyLand
Member
Member
Posts: 213
Joined: Mon Jun 16, 2014 5:33 pm
Location: Costa Rica

Re: New Python Projects

Post 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
Last edited by KemyLand on Sat Apr 18, 2015 11:14 am, edited 1 time in total.
Happy New Code!
Hello World in Brainfuck :D:

Code: Select all

++++++++[>++++[>++>+++>+++>+<<<<-]>+>+>->>+[<]<-]>>.>---.+++++++..+++.>>.<-.<.+++.------.--------.>>+.>++.
[/size]
User avatar
iansjack
Member
Member
Posts: 4703
Joined: Sat Mar 31, 2012 3:07 am
Location: Chichester, UK

Re: New Python Projects

Post 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.
User avatar
KemyLand
Member
Member
Posts: 213
Joined: Mon Jun 16, 2014 5:33 pm
Location: Costa Rica

Re: New Python Projects

Post 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.
Happy New Code!
Hello World in Brainfuck :D:

Code: Select all

++++++++[>++++[>++>+++>+++>+<<<<-]>+>+>->>+[<]<-]>>.>---.+++++++..+++.>>.<-.<.+++.------.--------.>>+.>++.
[/size]
mac
Member
Member
Posts: 144
Joined: Tue Sep 23, 2014 6:12 pm

Re: New Python Projects

Post 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?
cmdrcoriander
Member
Member
Posts: 29
Joined: Tue Jan 20, 2015 8:33 pm

Re: New Python Projects

Post 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 :)
User avatar
Muazzam
Member
Member
Posts: 543
Joined: Mon Jun 16, 2014 5:59 am
Location: Shahpur, Layyah, Pakistan

Re: New Python Projects

Post 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).
cmdrcoriander
Member
Member
Posts: 29
Joined: Tue Jan 20, 2015 8:33 pm

Re: New Python Projects

Post 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
mac
Member
Member
Posts: 144
Joined: Tue Sep 23, 2014 6:12 pm

Re: New Python Projects

Post by mac »

That is impossible with Python isn't it?
User avatar
iansjack
Member
Member
Posts: 4703
Joined: Sat Mar 31, 2012 3:07 am
Location: Chichester, UK

Re: New Python Projects

Post 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?
Post Reply