Cinema - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: Homework (https://python-forum.io/forum-9.html) +--- Thread: Cinema (/thread-1540.html) |
Cinema - ZeroSpin2309 - Jan-11-2017 The mission is to do a Python programm for a Cinema. Data for the cinema The cinema got 2 cinema halls (A and B) Every hall got 90 seats (6 Rows each 15 seats) The cinema is opened seven days a week and each day there are two performances of one film (it got two films= four perfomances a day)(16:30 and 20:30) Prices: At 16:30 = 13 EUR At 20:30 = 15 EUR Functionality All films/performances come from a JSON-file. The seats-reservation are saved in a JSON-file. The staff should see the price for the offer. The staff sees per perfomances the hall and the reservations Coding and Styles The program should run until someone shut it down. There should be no repetitions. RE: Cinema - Mekire - Jan-11-2017 (Jan-11-2017, 10:34 AM)ZeroSpin2309 Wrote: The mission is to do a Python programm for a Cinema.Your mission; not ours. What have you tried? Where are you stuck? RE: Cinema - ZeroSpin2309 - Jan-11-2017 (Jan-11-2017, 10:55 AM)Mekire Wrote:The point is I don't have any idea of Python. I'm doing this for a friend. And I thought here we got some Python Pros that can do this programm(Jan-11-2017, 10:34 AM)ZeroSpin2309 Wrote: The mission is to do a Python programm for a Cinema.Your mission; not ours. RE: Cinema - Larz60+ - Jan-11-2017 Ask you friend to contact the forum with own questions RE: Cinema - Mekire - Jan-11-2017 ZeroSpin2309 Wrote:And I thought here we got some Python Pros that can do this programmAny more comments like this and your thread is locked. This is the typical, "Well I thought this would be easy for you guys but I guess you aren't that good," type post. It will not be tolerated. Make an attempt or leave. RE: Cinema - ZeroSpin2309 - Jan-11-2017 (Jan-11-2017, 11:55 AM)Larz60+ Wrote: Ask you friend to contact the forum with own questions Don't be toxic guys... Why i can't ask you for a answer for a mission? Where's the problem if i got no idea? (Jan-11-2017, 12:11 PM)Mekire Wrote:ZeroSpin2309 Wrote:And I thought here we got some Python Pros that can do this programmAny more comments like this and your thread is locked. This is the typical, "Well I thought this would be easy for you guys but I guess you aren't that good," type post. I'm sorry I thought maybe you guys can help me. I don't now this. And I'm sorry when I can't programm on my own. RE: Cinema - Mekire - Jan-11-2017 (Jan-11-2017, 12:32 PM)ZeroSpin2309 Wrote: I'm sorry I thought maybe you guys can help me. I don't now this. And I'm sorry when I can't programm on my own.Yes we can and are willing to help, but we won't do it for you. If you start even with the most basic steps, we will offer advice and point you in the right direction. Currently my advice is, go read a basic Python tutorial, as it seems you don't have the basis to tackle such an assignment yet. Check out the tutorial section here. Ask some simple questions with examples of what you have tried and where you are having problems. This will lead to a dialogue that will assist you. As it stands though we aren't making any progress. RE: Cinema - ZeroSpin2309 - Jan-11-2017 #import import json print("Kino Hedinger") #Auswahlmenü des Filmes/Beenden print("1. Avatar") print("2. Hannibal") print("3. Beenden") film = int(input("Ihre Auswahl:")) if film == 1: print("Sie haben Avatar gewählt.") # Auswahl der Zeit print("Austrahlungszeiten") with open('data.json', 'r') as data_file: data = json.load(data_file) for element in data: if element["title"] == "Avatar": print(element["data"]) data_file.close() elif film == 2: print("Sie haben Hannibal gewählt.") else:That's everything i got. Now I'm asking myself how can I avoid that i have to write all these options after a input? I mean something like a variable for this context: print("Sie haben Avatar gewählt.") # Auswahl der Zeit print("Austrahlungszeiten") with open('data.json', 'r') as data_file: data = json.load(data_file) for element in data: if element["title"] == "Avatar": print(element["data"]) data_file.close() RE: Cinema - Mekire - Jan-11-2017 You would need to use a list or dictionary. This has not been tested but it would look something like this: #import import json options = ["Avatar", "Hannibal", "Beenden"] print("Kino Hedinger") #Auswahlmenü des Filmes/Beenden print("1. Avatar") print("2. Hannibal") print("3. Beenden") user_input = int(input("Ihre Auswahl:")) film_name = options[user_input-1] print("Sie haben {} gewählt.".format(film_name)) # Auswahl der Zeit print("Austrahlungszeiten") with open('data.json', 'r') as data_file: data = json.load(data_file) for element in data: if element["title"] == film_name: print(element["data"]) RE: Cinema - ZeroSpin2309 - Jan-12-2017 #import import json def linien(zeichen): outtext = " " for i in range (1, 100): outtext += zeichen print (outtext) #Tabellen options = ["Avatar", "Hannibal", "Beenden"] linien("-") print("Kino Hedinger") linien("-") #Auswahlmenü des Filmes/Beenden print("1. Avatar") print("2. Hannibal") print("3. Beenden") linien("-") user_input = int(input("Ihre Auswahl:")) if user_input >= 3: quit() file_name = options[user_input-1] print("Sie haben {} gewählt.".format(file_name)) linien("-") # Auswahl der Zeit print("Austrahlungszeiten") with open('data.json', 'r') as data_file: data = json.load(data_file) n = 1 for element in data: if element["title"] == file_name: daten = element["data"] print("%s. %s"% (n,daten)) n += 1 linien("-") time = int(input("Ihre Auswahl:")) if time == 1: print("Sie haben 16:30 gewählt.") elif time == 2: print("Sie haben 20:30 gewählt.") linien("-") #Reservationen with open('data.json', 'r') as data_file: data = json.load(data_file) for element in data: if element["title"] == file_name and element["data"] == "16:30 Uhr": row1 = element["row1"] row2 = element["row2"] row3 = element["row3"] row4 = element["row4"] row5 = element["row5"] row6 = element["row6"] print(" %s"% row1) print(" %s"% row2) print(" %s"% row3) print(" %s"% row4) print(" %s"% row5) print(" %s"% row6) elif element["title"] == file_name and element["data"] == "20:30 Uhr": row1 = element["row1"] row2 = element["row2"] row3 = element["row3"] row4 = element["row4"] row5 = element["row5"] row6 = element["row6"] print(" %s"% row1) print(" %s"% row2) print(" %s"% row3) print(" %s"% row4) print(" %s"% row5) print(" %s"% row6)So now it shows me the Seats (all the seats). But now I'd like to connect the time automatically to the selection of the rows. So when I say I'd like to watch the film at 16:30 it should automatically fill in the time in the reservations. btw. all is connected to a JSON-file |