OSDev.org

The Place to Start for Operating System Developers
It is currently Fri Oct 30, 2020 7:43 pm

All times are UTC - 6 hours




Post new topic Reply to topic  [ 17 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: New Python Projects
PostPosted: Fri Apr 17, 2015 2:16 am 
Offline
Member
Member

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


Top
 Profile  
 
 Post subject: Re: New Python Projects
PostPosted: Sat Apr 18, 2015 3:06 am 
Offline
Member
Member
User avatar

Joined: Mon Jun 16, 2014 5:33 pm
Posts: 213
Location: Costa Rica
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:
++++++++[>++++[>++>+++>+++>+<<<<-]>+>+>->>+[<]<-]>>.>---.+++++++..+++.>>.<-.<.+++.------.--------.>>+.>++.


Top
 Profile  
 
 Post subject: Re: New Python Projects
PostPosted: Sat Apr 18, 2015 5:39 am 
Offline
Member
Member
User avatar

Joined: Mon Jun 16, 2014 5:59 am
Posts: 543
Location: Shahpur, Layyah, Pakistan
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.

Top
 Profile  
 
 Post subject: Re: New Python Projects
PostPosted: Sat Apr 18, 2015 5:45 am 
Offline
Member
Member
User avatar

Joined: Mon Jun 16, 2014 5:33 pm
Posts: 213
Location: Costa Rica
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:
++++++++[>++++[>++>+++>+++>+<<<<-]>+>+>->>+[<]<-]>>.>---.+++++++..+++.>>.<-.<.+++.------.--------.>>+.>++.


Top
 Profile  
 
 Post subject: Re: New Python Projects
PostPosted: Sat Apr 18, 2015 5:47 am 
Offline
Member
Member
User avatar

Joined: Mon Jun 16, 2014 5:59 am
Posts: 543
Location: Shahpur, Layyah, Pakistan
What about creating an (artificial (user-mode)) operating system in Python? (OSDev+Python)


Top
 Profile  
 
 Post subject: Re: New Python Projects
PostPosted: Sat Apr 18, 2015 5:49 am 
Offline
Member
Member
User avatar

Joined: Mon Jun 16, 2014 5:33 pm
Posts: 213
Location: Costa Rica
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:
++++++++[>++++[>++>+++>+++>+<<<<-]>+>+>->>+[<]<-]>>.>---.+++++++..+++.>>.<-.<.+++.------.--------.>>+.>++.


Top
 Profile  
 
 Post subject: Re: New Python Projects
PostPosted: Sat Apr 18, 2015 5:51 am 
Offline
Member
Member
User avatar

Joined: Mon Jun 16, 2014 5:33 pm
Posts: 213
Location: Costa Rica
BTW, for the sake of completeness, an example, possible code for calculating Pi using Leibniz's series would be:
Code:
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

_________________
Happy New Code!
Hello World in Brainfuck :D:
Code:
++++++++[>++++[>++>+++>+++>+<<<<-]>+>+>->>+[<]<-]>>.>---.+++++++..+++.>>.<-.<.+++.------.--------.>>+.>++.


Last edited by KemyLand on Sat Apr 18, 2015 11:14 am, edited 1 time in total.

Top
 Profile  
 
 Post subject: Re: New Python Projects
PostPosted: Sat Apr 18, 2015 10:37 am 
Offline
Member
Member
User avatar

Joined: Sat Mar 31, 2012 3:07 am
Posts: 3976
Location: Chichester, UK
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.


Top
 Profile  
 
 Post subject: Re: New Python Projects
PostPosted: Sat Apr 18, 2015 11:13 am 
Offline
Member
Member
User avatar

Joined: Mon Jun 16, 2014 5:33 pm
Posts: 213
Location: Costa Rica
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:
++++++++[>++++[>++>+++>+++>+<<<<-]>+>+>->>+[<]<-]>>.>---.+++++++..+++.>>.<-.<.+++.------.--------.>>+.>++.


Top
 Profile  
 
 Post subject: Re: New Python Projects
PostPosted: Sat Apr 18, 2015 6:28 pm 
Offline
Member
Member

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


Top
 Profile  
 
 Post subject: Re: New Python Projects
PostPosted: Sat Apr 18, 2015 6:31 pm 
Offline
Member
Member

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


Top
 Profile  
 
 Post subject: Re: New Python Projects
PostPosted: Sun Apr 19, 2015 1:25 am 
Offline
Member
Member
User avatar

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


Top
 Profile  
 
 Post subject: Re: New Python Projects
PostPosted: Sun Apr 19, 2015 2:59 am 
Offline
Member
Member

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


Top
 Profile  
 
 Post subject: Re: New Python Projects
PostPosted: Sun Apr 19, 2015 11:16 pm 
Offline
Member
Member

Joined: Tue Sep 23, 2014 6:12 pm
Posts: 144
That is impossible with Python isn't it?


Top
 Profile  
 
 Post subject: Re: New Python Projects
PostPosted: Mon Apr 20, 2015 1:52 am 
Offline
Member
Member
User avatar

Joined: Sat Mar 31, 2012 3:07 am
Posts: 3976
Location: Chichester, UK
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?


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 17 posts ]  Go to page 1, 2  Next

All times are UTC - 6 hours


Who is online

Users browsing this forum: Google [Bot] and 5 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group