referencing multiple lists and dictionaries in novelty ways
<p>first post so please forgive formatting etc.</p>

<p>I was trying to create a program that gave an alarm time based on whether it was a week day / weekend and whether it was a vacation</p>

<p>heres the code:</p>

<pre><code>days = {0:"sun",
        1:"mon",
        2:"tue",
        3:"wed",
        4:"thurs",
        5:"fri",
        6:"sat",
    }
types = {"weekdays": ["mon", "tue", "wed", "thurs", "fri"],
        "weekend": ["sun", "sat"]
         }
times = {"7:00":"weekdays",
         "10:00":"weekend"}
#vacation = False

def alarm_clock(day, vacation):
    x = days[day]

    #for i in days:
    if vacation == False:
        y = list(times.keys())[list(times.values()).index()]#incomplete function that should return "weekend" or "weekday" based on input
        return (list(times.keys())[list(times.values()).index(#function that returns either "weekend" or weekday" here# y    )])      ## checks the entered number in days; that value is then checked in both lists in types to see whether it is in "weekend" or "weekdays"; that value is then used to give the final time of alarm (7:00 or 10:00)
</code></pre>

<p>This is in python 3.4 and currently returns the error when alarm_clock(1,False) is entered into shell</p>

<pre><code>TypeError: index() takes at least 1 argument (0 given)
</code></pre>

<p>i wasn't expecting this to work, Im looking for advice on how to do things differently.</p>

<p>Im sorry if this is a stupid question, maybe im just bad and i should gitgud</p>

<p>I give you credit for apologising for the formatting, but if you want people to help you with your code, they have to understand it.</p>

<h3>Possible issue</h3>

<p>I don't know if I see it correctly but on the line where <em>'y'</em> is defined, there is an empty <em>'.index()'</em> function ( possibly the one causing TypeErrors?)</p>

<p>Idk really, since the code is half incomplete I can't be totally sure.</p>

python list dictionary