943,937 Members | Top Members by Rank

Ad:
  • Python Discussion Thread
  • Unsolved
  • Views: 503
  • Python RSS
Nov 1st, 2009
0

Input /variable...

Expand Post »
Hi,

I am new at Python..i have been asked to create a code for the following item.

A user needs to input the 'room number' and 'date' to equal a answer.

Room Number: R1, R2, R3, R4, R5

R1 = Dates: 1/01/2000, 01/02/2000, 01/03/2000
R2 = Dates: 01/01/2000, 01/03/2000
R3 = Dates: 0/01/2000, 0/01/2000, 0/01/2000
R4 = Dates: 0/01/2000, 0/01/2000, 0/01/2000
R5 = Dates: 0/01/2000, 0/01/2000

R1 01/01/2000 Library1
R1 01/02/2000 Library2
R1 01/03/2000 Class1

R2 01/01/2000 Library2
R2 01/02/2000 Library1
R2 01/03/2000 Class2

R3 01/02/2000 Library3
R3 01/03/2000 Class3

R4 01/03/200 Class4

R5 01/01/2000 Class4
R5 01/02/2000 Library4

What do you start doing first the Input, Define method first??
Reputation Points: 10
Solved Threads: 0
Newbie Poster
python123 is offline Offline
4 posts
since Nov 2009
Nov 1st, 2009
0
Re: Input /variable...
In simple terms:
Input Data --> Process Data --> Output Processed Data
Moderator
Reputation Points: 1333
Solved Threads: 1403
DaniWeb's Hypocrite
vegaseat is offline Offline
5,792 posts
since Oct 2004
Nov 1st, 2009
0
Re: Input /variable...
I think on programs like this you need to start by thinking about how it should look to the end user. What do you want the program to ask for and what do you want it to respond with.

Then I like to start by breaking it down into smaller parts. First, I'm just going to collect my input like Vegaseat said up above. So write up some code that collects the input and then just prints it back out. Once you've got that working, then put in some code that processes some of the data. Once you've got that working, then you should have a pretty good idea of what functions you need to define so that you can perform that process on all of the users input.

Do you need more specific help on this assignment? Is there a particular thing that you're not understanding? I think the hardest programs are the ones where you don't know where to start.
Reputation Points: 16
Solved Threads: 35
Junior Poster
mn_kthompson is offline Offline
148 posts
since Nov 2007
Nov 2nd, 2009
0
Re: Input /variable...
Hi,
I i have created the first part to input data:

def results ():
roomnumber = input ("Enter Room Number: ")
date = input (" Enter the Date: ")
print roomnumber + date

i am unsure what to do after this how to start create items for the rooms and dates?
Reputation Points: 10
Solved Threads: 0
Newbie Poster
python123 is offline Offline
4 posts
since Nov 2009
Nov 2nd, 2009
0
Re: Input /variable...
Unsure whether i could use this:

roomnumber = {'L1': '01/01/2000', '01/02/2000' etc

unsure if this makes sense?
Reputation Points: 10
Solved Threads: 0
Newbie Poster
python123 is offline Offline
4 posts
since Nov 2009
Nov 2nd, 2009
0
Re: Input /variable...
Double post, sorry.
Last edited by woooee; Nov 2nd, 2009 at 11:21 am.
Reputation Points: 741
Solved Threads: 692
Nearly a Posting Maven
woooee is offline Offline
2,307 posts
since Dec 2006
Nov 2nd, 2009
0
Re: Input /variable...
Since you are using python 2.x, this won't work. Test this code by entering "R1" and "1/01/2000" and see what happens ( and look at "Is there an easy way to do user input in python?" here http://www.faqts.com/knowledge_base/index.phtml/fid/245 ).
Python Syntax (Toggle Plain Text)
  1. def results ():
  2. roomnumber = input ("Enter Room Number: ")
  3. date = input (" Enter the Date: ")
  4. print roomnumber + date
Reputation Points: 741
Solved Threads: 692
Nearly a Posting Maven
woooee is offline Offline
2,307 posts
since Dec 2006
Nov 2nd, 2009
0
Re: Input /variable...
What about the next part?

I am trying to create the table above i.e if the user inputs R1 and the 01/01/2000 then will bring up the class(1,2,3 etc) or library(1,2,3etc).

Could i use something like:

roomnumber = {'L1': '01/01/2000', '01/02/2000' etc

or do i have to do it differently? I am trying to process the data that is being entered...
Last edited by python123; Nov 2nd, 2009 at 4:37 pm. Reason: more info
Reputation Points: 10
Solved Threads: 0
Newbie Poster
python123 is offline Offline
4 posts
since Nov 2009

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Python Forum Timeline: Pygame question
Next Thread in Python Forum Timeline: Python3.1.1 can't assign function result to variable





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC