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??

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.

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?

Unsure whether i could use this:

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

unsure if this makes sense?

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 ).

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

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...

Edited 7 Years Ago by python123: more info

This article has been dead for over six months. Start a new discussion instead.