[Tutor] learning how to use python

2005-06-09 Thread Goofball223
I am new to programming and this is the first language that I will be learning. I am trying to get the shell to print "hello world". I followed all of the steps to save it and then run the file to get it to print in the shell. the shell gives me an error and also says that personal firewall software is blocking the connection. does anyone have any suggestions on how i could fix this problem?

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


[Tutor] FIREWALLS

2005-09-02 Thread Goofball223


I used python several months ago to write a simple program now i went back to use it to rewrite the same program and when I try to run it it says that my firewalls may be to secure. everytime the program runs in python it restarts and just has empty lines. how do I change my firewalls to be able to run a program in python? I have tried using different versions of python
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


[Tutor] FIREWALLS

2005-09-02 Thread Goofball223
I used python several months ago to write a simple program now i went back to use it to rewrite the same program and when I try to run it it says that my firewalls may be to secure. everytime the program runs in python it restarts and just has empty lines. how do I change my firewalls to be able to run a program in python? I have tried using different versions of python
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


[Tutor] making a table

2005-09-08 Thread Goofball223
I would like to construct a table for my program but it does not seem to be coming out evenly. Could someone please let me know what to do so that everything will work out correctly?

def main():
    print "This program shows a table of Celsius temperatures and there Fahrenheit equivalents every 10 degrees from 0C to 100C"
    print "C F"
    for i in(0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100):
    fahrenheit = (9.0/5.0) * i + 32
    print i
    print "   ",
    print fahrenheit
    
main() 
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


[Tutor] where to insert?

2005-09-22 Thread Goofball223
I would like to insert string.join(msgList,"") into the following program where do I insert it?

# numbers2text.py
# A program to convert a sequence of ASCII numbers into
# a string of text.

import string  # include string library for the split function.

def main():
    print "This program converts a sequence of ASCII numbers into"
    print "the string of text that it represents."
    print
    
    # Get the message to encode
    inString = raw_input("Please enter the ASCII-encoded message: ")

    # Loop through each substring and build ASCII message
    message = ""
    for numStr in string.split(inString):
    asciiNum = eval(numStr)   # convert digits to a number
    message = message + chr(asciiNum) # append character to message

    print "The decoded message is:", message

main()
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


[Tutor] simplifying with string-formatting operator

2005-09-23 Thread Goofball223
Hello

Does anyone have any idea on how i could simplify the following program by using strings?

# dateconvert2.py
#    Converts day month and year numbers into two date formats

import string

def main():
    # get the day month and year
    day, month, year = input("Please enter the day, month and year numbers: ")

    date1 = str(month)+"/"+str(day)+"/"+str(year)

    months = ["January", "February", "March", "April",
  "May", "June", "July", "August",
  "September", "October", "November", "December"]
    monthStr = months[month-1]
    date2 = monthStr+" " + str(day) + ", " + str(year)

    print "The date is", date1, "or", date2

main()

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


[Tutor] (no subject)

2005-09-24 Thread Goofball223
Hello

How would I get the following program to accept inputs of exam scores from 0-100 with A being 100-90, B being 89-80, C being 79-70, D being 69-60, and F being everything less than 60?

import string

def main():


    scores = ["F", "D", "C", "B", "A"]
    g = input("Enter a score number (0-100): ")

    print "The score of your exam is", scores [g-0] + "."


main()   
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


[Tutor] creating strings

2005-09-24 Thread Goofball223
Hello

How would I get the following program to accept inputs of exam scores from 0-100 with A being 100-90, B being 89-80, C being 79-70, D being 69-60, and F being everything less than 60?

import string

def main():


   scores = ["F", "D", "C", "B", "A"]
   g = input("Enter a score number (0-100): ")

   print "The score of your exam is", scores [g-0] + "."


main()   
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


[Tutor] numbers from a name

2005-09-24 Thread Goofball223
Hello

with the following program I would like it to be able to take a person's name  and then assign values to each letter and come up with a sum of all the letters in the name. for example if I entered bob. i would like the program to be able to print bob and then print the total of bob which would be 2 + 15 + 2 = 18. 





import string

def main():
    value = (raw_input("Please enter your first name"))

 table = {'a' : 1, 'b' : 2, 'c' : 3, 'd' : 4, 'e' : 5, 'f' : 6, 'g' : 7, 'h' : 8, 'i' : 9, 'j' : 10, 'k' : 11, 'l' : 12, 'm' : 13, 'n' : 14, 'o' : 15, 'p' : 16, 'q' : 17, 'r' : 18, 's' : 19, 't' : 20, 'u' : 21, 'v' : 22, 'w' : 23, 'x' : 24, 'y' : 25, 'z' : 26}


 total = 0
 name = list(name)

 for string in name:
 total += table[string.lower()]
 print "The total of your name is:", total

main()

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] numbers from a name

2005-09-24 Thread Goofball223
How could I change the program to accept something like: John Bob Zelle Python or Kip Rada?
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


[Tutor] help getting acronym to print?

2005-09-25 Thread Goofball223
Hello

How could I get the following program to output UDP from the user entering user datagram protcol or IP if internet protocla was entered?

currently it only prints out on letter



import string

def main():


    phrase = (raw_input("Please enter a phrase:"))

    acr1 = string.split(phrase)
    print"",acr1 #only using print to see where I am

    acr2 = string.capwords(phrase)
    print"",acr2 #only using print to see where I am
    for phrase in string.split(phrase): 
 acronym = string.upper(phrase[0])
    
    print "", acronym
main()
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


[Tutor] help with running graphics program

2005-09-28 Thread Goofball223
Hello

I downloaded the graphics.py file and have it saved on my computer but everytime I run the following program I seem to keep getting an error.

from graphics import*

def main():
    win=GraphWin()
    shape = Circle(Point(50,50), 20)
    shape.setOutline("red")
    shape.setFill("red")
    shape.draw(win)
    for i in range(10):
    p = win.getMouse()
    c = shape.getCenter()
    dx = p.getX() - c.getX()
    dy = p.getY -c.getY()
    shape.move(dx,dy)
    win.close()
main()   


Traceback (most recent call last):
  File "C:/Python24/circle", line 1, in -toplevel-
    from graphics import*
ImportError: No module named graphics

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


[Tutor] drawing squares

2005-09-28 Thread Goofball223
Hello

How would I get the following program to draw squares instead of circles?


from graphics import*

def main():
    win=GraphWin()
    shape = Circle(Point(50,50), 20)
    shape.setOutline("red")
    shape.setFill("blue")
    shape.draw(win)
    for i in range(10):
    p = win.getMouse()
    c = shape.getCenter()
    dx = p.getX() - c.getX()
    dy = p.getY -c.getY()
    shape.move(dx,dy)
    win.close()
main() 
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor