Input /variable...

Reply

Join Date: Nov 2009
Posts: 4
Reputation: python123 is an unknown quantity at this point 
Solved Threads: 0
python123 python123 is offline Offline
Newbie Poster

Input /variable...

 
0
  #1
26 Days Ago
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??
Reply With Quote Quick reply to this message  
Join Date: Oct 2004
Posts: 4,000
Reputation: vegaseat is just really nice vegaseat is just really nice vegaseat is just really nice vegaseat is just really nice vegaseat is just really nice 
Solved Threads: 927
Moderator
vegaseat's Avatar
vegaseat vegaseat is online now Online
DaniWeb's Hypocrite
 
0
  #2
26 Days Ago
In simple terms:
Input Data --> Process Data --> Output Processed Data
May 'the Google' be with you!
Reply With Quote Quick reply to this message  
Join Date: Nov 2007
Posts: 141
Reputation: mn_kthompson is an unknown quantity at this point 
Solved Threads: 32
mn_kthompson mn_kthompson is offline Offline
Junior Poster
 
0
  #3
25 Days Ago
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.
Reply With Quote Quick reply to this message  
Join Date: Nov 2009
Posts: 4
Reputation: python123 is an unknown quantity at this point 
Solved Threads: 0
python123 python123 is offline Offline
Newbie Poster
 
0
  #4
25 Days Ago
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?
Reply With Quote Quick reply to this message  
Join Date: Nov 2009
Posts: 4
Reputation: python123 is an unknown quantity at this point 
Solved Threads: 0
python123 python123 is offline Offline
Newbie Poster
 
0
  #5
25 Days Ago
Unsure whether i could use this:

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

unsure if this makes sense?
Reply With Quote Quick reply to this message  
Join Date: Dec 2006
Posts: 1,008
Reputation: woooee is a jewel in the rough woooee is a jewel in the rough woooee is a jewel in the rough 
Solved Threads: 285
woooee woooee is online now Online
Veteran Poster
 
0
  #6
25 Days Ago
Double post, sorry.
Last edited by woooee; 25 Days Ago at 11:21 am.
Linux counter #99383
Reply With Quote Quick reply to this message  
Join Date: Dec 2006
Posts: 1,008
Reputation: woooee is a jewel in the rough woooee is a jewel in the rough woooee is a jewel in the rough 
Solved Threads: 285
woooee woooee is online now Online
Veteran Poster
 
0
  #7
25 Days Ago
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 ).
  1. def results ():
  2. roomnumber = input ("Enter Room Number: ")
  3. date = input (" Enter the Date: ")
  4. print roomnumber + date
Linux counter #99383
Reply With Quote Quick reply to this message  
Join Date: Nov 2009
Posts: 4
Reputation: python123 is an unknown quantity at this point 
Solved Threads: 0
python123 python123 is offline Offline
Newbie Poster
 
0
  #8
24 Days Ago
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; 24 Days Ago at 4:37 pm. Reason: more info
Reply With Quote Quick reply to this message  
Reply

Message:



Other Threads in the Python Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC