Re: [Tutor] User Input with Multiple Lines

2014-10-26 Thread eryksun
On Sun, Oct 26, 2014 at 3:25 PM, Malik Brahimi wrote: > So I am working with input that is pasted from a PDF file, and I was > wondering if there is any way I can do so without the program terminating > abruptly because of the newlines. input() and raw_input() grab a single line of text. The rest

Re: [Tutor] User Input with Multiple Lines

2014-10-26 Thread Ben Finney
Malik Brahimi writes: > So I am working with input that is pasted from a PDF file, and I was > wondering if there is any way I can do so without the program > terminating abruptly because of the newlines. Can you construct a *very* short and simple example program, which demonstrates the problem

[Tutor] User Input with Multiple Lines

2014-10-26 Thread Malik Brahimi
So I am working with input that is pasted from a PDF file, and I was wondering if there is any way I can do so without the program terminating abruptly because of the newlines. I know that multiple lines of input can be achieved via a loop with string concatenation, but this is not what I'm looking

Re: [Tutor] user input help

2011-01-05 Thread Alan Gauld
"Jason Staudenmayer" wrote I'm working on a small program to add users to a sqlite db. Try the database topic in my tutorial where I do a very similar thing... code follows - def promptInput(): ... result = (lname, fname, email) return result def getEmplyInfo():

Re: [Tutor] user input help

2011-01-05 Thread Jason Staudenmayer
> -Original Message- > From: Alex Hall [mailto:mehg...@gmail.com] > Sent: Wednesday, January 05, 2011 3:23 PM > To: Jason Staudenmayer > Cc: tutor@python.org > Subject: Re: [Tutor] user input help > > > On 1/5/11, Jason Staudenmayer wrote: > > Hi all,

Re: [Tutor] user input help

2011-01-05 Thread Alex Hall
On 1/5/11, Jason Staudenmayer wrote: > Hi all, I'm pretty new to programming in general and figured I'd try out > python. > I'm working on a small program to add users to a sqlite db. The problem I'm > having it dealing with the user input, I'd like to be able to repeat the > function to get the i

[Tutor] user input help

2011-01-05 Thread Jason Staudenmayer
Hi all, I'm pretty new to programming in general and figured I'd try out python. I'm working on a small program to add users to a sqlite db. The problem I'm having it dealing with the user input, I'd like to be able to repeat the function to get the input if the user doesn't accept it. here's

Re: [Tutor] User Input List and Sort

2007-02-14 Thread Rikard Bosnjakovic
On 2/14/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > Every example of a list that I've seen involves working with, sorting, etc > pre-populated list. How can I create a list where the user inputs a string > of numbers and then sorts it? The code of yours gets a commaseparated _string_, whi

[Tutor] User Input List and Sort

2007-02-14 Thread [EMAIL PROTECTED]
Every example of a list that I've seen involves working with, sorting, etc pre-populated list. How can I create a list where the user inputs a string of numbers and then sorts it? I've tried: print "Input list separated by commas" lst=[raw_input()] print lst print len(lst) lst.sort() print lst

Re: [Tutor] User input

2006-05-22 Thread Danny Yoo
> The second version works. > > print "Total trip cost is US$", float(distance) / > (float(mpg) * float(galon_price)) Hi Matt, Although this works, we'll probably want to do the type conversions as early as possible. We can write a function input_float() that wraps up the float(raw_input()) s

Re: [Tutor] User input

2006-05-22 Thread MATATA EMMANUEL
Thanks Kelly. The second version works. print "Total trip cost is US$", float(distance) /(float(mpg) * float(galon_price))Matt   From:  Kelly Vincent <[EMAIL PROTECTED]>To:  MATATA EMMANUEL <[EMAIL PROTECTED]>, Tutor@python.orgSubject:  Re: [Tutor] User inputDate:  Mon, 22 May 2006 15:19:12 +

Re: [Tutor] User input

2006-05-22 Thread URBAN LANDREMAN
re more experienced may have suggestions for more elegant code. Urban Landreman >From: "MATATA EMMANUEL" <[EMAIL PROTECTED]> >To: Tutor@python.org >Subject: [Tutor] User input >Date: Mon, 22 May 2006 09:58:04 -0400 >MIME-Version: 1.0 >X-Originating-IP: [199.90

Re: [Tutor] User input

2006-05-22 Thread Kelly Vincent
raw_input reads in the value as a string, so you need to convert it at some point to a number. You can either do this at the point where you read the value in, or when you do the calculation/print. To convert it at the input stage (probably the most logical), add float() such as mpg = float(raw_i

Re: [Tutor] User input

2006-05-22 Thread Ewald Ertl
MATATA EMMANUEL wrote: > Hi there, > > Can anyone tell me how I'm having trouble executing this piece of code: > > mpg = raw_input (" Enter your mileage:") > distance = raw_input ("Enter your distance:") > galon_price = raw_input ("Enter you cost per gallon:") > make = "Honda" > model = "Accord"

[Tutor] User input

2006-05-22 Thread MATATA EMMANUEL
Hi there, Can anyone tell me how I'm having trouble executing this piece of code: mpg = raw_input (" Enter your mileage:")distance = raw_input ("Enter your distance:")galon_price = raw_input ("Enter you cost per gallon:")make = "Honda"model = "Accord"##print make, model, "mileage is", mpg, "miles