The Idiots Guide To Python

Discuss mods and get help with mods ONLY
This topic is 15 years and 11 months old. Instead of replying, please begin a new topic, or search for another related topic that may be more suitable.
Hes back!
baseballplayinty
Member
Posts: 332
Joined: September 22nd, 2007
Location: Michigan
Reputation: 0
Contact:

Re: The Idiots Guide To Python

Postby baseballplayinty » Mon Oct 20, 2008 5:51 pm

iamnoob wrote:Vote to sticky if baseball commits to working on this :tongue2:

:laugh:

How Do I run the things I type in? I tried run but I can't find the script, and it won't let me save it. ;(


Ill look at the best to show how one sec
I support...
http://www.fretsonfire.org
http://www.FansOnFire.tk
and FoFix

If you EVER need help with anything just ask me i can probably can help you and will try to point you in the best direction if i can't give you the info directly.
R4nd0M
Member
Posts: 517
Joined: January 21st, 2008
Location: Sydney
Reputation: 2

Re: The Idiots Guide To Python

Postby R4nd0M » Tue Oct 21, 2008 2:30 am

iamnoob wrote:Vote to sticky if baseball commits to working on this :tongue2:

:laugh:

How Do I run the things I type in? I tried run but I can't find the script, and it won't let me save it. ;(


Until baseball includes this in more detail:

Save your code in a .py text file. Open up command prompt (run -> cmd) now assuming you've setup your path stuff right: cd to the folder where your program is, then type:

python file.py

replace "file" with the name of your script/program.
User avatar
iamnoob
Member
Posts: 1193
Joined: February 27th, 2008
Reputation: 0
Contact:

Re: The Idiots Guide To Python

Postby iamnoob » Tue Oct 21, 2008 5:24 pm

I can't get it to save as a .py :thumbdown:
Image
Hes back!
baseballplayinty
Member
Posts: 332
Joined: September 22nd, 2007
Location: Michigan
Reputation: 0
Contact:

Re: The Idiots Guide To Python

Postby baseballplayinty » Tue Oct 21, 2008 7:29 pm

Sorry for not updating this had the meap (Michigan Education Assessment P*******)

@Iamnoob when saving the file did you put example.py if not add .py to the end of your file name (If you are using the GUI)

Image

Image

Image

Image

Image
I support...
http://www.fretsonfire.org
http://www.FansOnFire.tk
and FoFix

If you EVER need help with anything just ask me i can probably can help you and will try to point you in the best direction if i can't give you the info directly.
not a robot
User avatar
raph666
Administrator
Posts: 2428
Joined: March 9th, 2007
Location: dans la mer du nord
Reputation: 20
Contact:

Re: The Idiots Guide To Python

Postby raph666 » Tue Oct 21, 2008 9:33 pm

Note that you do not need to create a module for every small scripts you make, especially when learning/testing like this, the IDLE python shell (as displayed in previous post) can be used to directly write small scripts. It is not efficient for any "real" programs but is handy enough to let you figure out some code. The cmd shell works the same way:
Image
User avatar
iamnoob
Member
Posts: 1193
Joined: February 27th, 2008
Reputation: 0
Contact:

Re: The Idiots Guide To Python

Postby iamnoob » Thu Oct 23, 2008 5:19 pm

Whats the exact download you got baseball, because mine isn't working properly. :thumbdown:
Image
not a robot
User avatar
raph666
Administrator
Posts: 2428
Joined: March 9th, 2007
Location: dans la mer du nord
Reputation: 20
Contact:

Re: The Idiots Guide To Python

Postby raph666 » Thu Nov 13, 2008 2:11 pm

iamnoob wrote:Whats the exact download you got baseball, because mine isn't working properly. :thumbdown:

I suggest you remove the existing python versions on your computer and get ActiveState python: http://www.activestate.com/store/downlo ... 0c2dea2758
Simply choose if you want python 2.5 or 2.4

Since the topic has not been bumped in a while I thought maybe I could contribute. I'm not hi-jacking it, meaning I'm not willing to take baseballplayinty's place and do multiple python's lessons. Also, remember that I'm no python professional, I'm still learning and can't do much. All this said, I made this little pizza.py a couple of weeks ago out of boredom and thought I'd share it with you now.

Code: Select all

#---------------------------------------------------------------#
#                                                               #
# pizza.py                                                      #
# ePizza making program                                         #           
# functions definition example.                                 #               
#                                                               #
#   In this module we build a virtual pizza making              #
#   machine using various functions. It shows how an            #
#   argument is passed to a function. You can see               #
#   functions like little parts of a bigger, more complex       #   
#   machine. When the machine wants to do something, it         #
#   "calls" one of it's little part, one of it's function,      #
#   to execute the task.                                        #
#---------------------------------------------------------------#


# We first
# need to define some pizza making functions if we want to
# use them later.
#
#   These are simple functions that simply manage
#   display operations:

# the sauce adder, it receives the sauceType argument

def addSauce(sauceType):
    print "We first add " + sauceType + " sauce"


# Just like the previous function, the followings receive an argument
# but note that a function does not need to receive any arguments at all.
# It's good practice to give explicit names to your functions so people easily
# understand what they do:

def addMeat(meatType):
    print "We then add some " + meatType

def addVeggies(veggieType): 
    print "Now with some veggies, why not some " + veggieType

def addCheese(cheeseType):
    print "Finally we put some " + cheeseType + " cheese!"

# We're done with the functions.
# Under is the pizza making program core, it is like a list
# of the things that should happen in the order they should
# happen.

print "We are making some pizza!\n"     #the \n character jumps to a new line
addSauce("bbq")      #we add some bbq sauce, sent to the function as an argument
addMeat("chicken")   #We add meat,
addVeggies("hot peppers")  #we add some mushrooms and peppers
addCheese("mozarella")        #Finally we add cheese!
print "\nBake that! It's gonna make some nice pizza!" #Pizza is ready!


As a challenge, people could use what is seen in the previous posts to make it so you can input yourself the type of ingredients for custom pizzas.
Hes back!
baseballplayinty
Member
Posts: 332
Joined: September 22nd, 2007
Location: Michigan
Reputation: 0
Contact:

Re: The Idiots Guide To Python

Postby baseballplayinty » Tue Jun 16, 2009 6:38 pm

Hey everyone, sorry for the absolutely massive bump but i was wondering how many of you want me to continue on with this guide. I will if i get a reasonable amount of yes's. Baseball season is finally winding down so i'm getting some free time :wink:
I support...
http://www.fretsonfire.org
http://www.FansOnFire.tk
and FoFix

If you EVER need help with anything just ask me i can probably can help you and will try to point you in the best direction if i can't give you the info directly.

Return to “FOF Mod Discussion and Support”

Who is online

Users browsing this forum: No registered users and 11 guests