[Tutor] Just started Python

2011-04-27 Thread Johnson Tran
Hi All, I am a complete beginner so my question will probably be pretty noob but: I started out with a short program below and I thought it was working although I cannot seem to figure out how to use the except ValueError so that when the user puts an invalid answer the program does not read wi

Re: [Tutor] Just started Python

2011-04-27 Thread Johnson Tran
total miles to gallon with those values. On Apr 27, 2011, at 10:02 AM, Alan Gauld wrote: > > "Johnson Tran" wrote > >> I started out with a short program below and I thought it was working >> although I cannot seem to figure out how to use the except ValueErro

Re: [Tutor] Just started Python

2011-04-27 Thread Johnson Tran
t "Your average number of miles to gallons is", print number1 / number2 Thanks guys created my first successful program ! =D On Apr 27, 2011, at 3:13 PM, Alan Gauld wrote: > > "Johnson Tran" wrote > >> Thanks for the reply Alan and Noah, I really appreciate

Re: [Tutor] Just started Python

2011-04-27 Thread Johnson Tran
Ahh, I was wondering about why it didn't show the error message on the first variable. Makes sense, thanks again. Sent from my iPhone On Apr 27, 2011, at 5:05 PM, Alan Gauld wrote: > > "Johnson Tran" wrote >> Okay so my final program is: > > It works but y

[Tutor] ValueError

2011-05-03 Thread Johnson Tran
Hi All, i am trying to create a program module with two functions (conversion inches to centimeters then centimeter to inches, I have my program working although I am trying to adda Value Error function to my program but cannot seem to it to work: def Conversion(): print "This program con

Re: [Tutor] ValueError

2011-05-03 Thread Johnson Tran
quot;, line 16, in Conversion() File "/Users/JT/Desktop/hw#2.py", line 9, in Conversion centimeters = input("Enter length in centimeters: ") File "", line 1, in NameError: name 'fs' is not defined On May 3, 2011, at 4:00 AM, Corey Richardson

Re: [Tutor] ValueError

2011-05-03 Thread Johnson Tran
I am using python 2.5...and adding raw_input has fixed the issue, thank you! On May 3, 2011, at 5:01 AM, Peter Otten wrote: > Johnson Tran wrote: > >> Thanks for the replies..so I added the "try" block but it still does not >> seem to be outputting my defau

[Tutor] Python program with multiple answers

2011-05-11 Thread Johnson Tran
Hi Guys, I've been working on a Python program where I create an 8 ball that will allow you to ask questions and will reply back with 20 possible answers. It will be continuous until the user says quit. My program works fine although I am trying to add something more to it, where when the user

Re: [Tutor] Python program with multiple answers

2011-05-11 Thread Johnson Tran
True = 0 raw_input() else: print "Error -- Try again\n" answer_list=??? <--not sure answer_list.sort() print "Your answer's sorted:", answer_list On May 11, 2011, at 5:57 AM, Brett Ritter wro

Re: [Tutor] Just Joined!

2011-05-13 Thread Johnson Tran
Okay I think I understand now. Is there a module i need to import though when defining ?I did a help("module"), not sure which module is the correct one to make swapcase.center work properly... On May 12, 2011, at 10:17 AM, Alan Gauld wrote: > > "Alex Smith" wrote >> SwapcaseAndCenter('hello

Re: [Tutor] Just Joined!

2011-05-13 Thread Johnson Tran
You can ignore last question, was trying to figure out Alex's issue as well, but I got it now. sorry for the spam! On May 13, 2011, at 3:57 AM, Johnson Tran wrote: > Okay I think I understand now. Is there a module i need to import though when > defining ?I did a help("mo

[Tutor] Program

2011-05-18 Thread Johnson Tran
Hi Again All, I had a couple questions about my program: def CollectNames(): answer_set=set([]) sorted_list = sorted(answer_set) word=raw_input("Name #1: ") word=raw_input("Name #2: ") word=raw_input("Name #3: ") word=raw_input("Name #4: ") word=raw_input(

Re: [Tutor] Program

2011-05-18 Thread Johnson Tran
e "/Users/JT/Desktop/pythonfinal", line 7, in CollectNames word.append(words) AttributeError: 'str' object has no attribute 'append' On May 18, 2011, at 5:39 AM, Corey Richardson wrote: > -BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > On 05/18/2011

Re: [Tutor] Program

2011-05-19 Thread Johnson Tran
ames outputted after the last name was collected (and sort them in alphabetical order. Took my sort commands out until I could figure out how to get any output first Thanks for any help. On May 18, 2011, at 7:57 AM, Alan Gauld wrote: > > "Johnson Tran" wrote > &g