Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- components = ("Processor",
- "RAM",
- "Storage",
- "Screen",
- "Case",
- "USB ports")
- choices = ("P3",
- "P5",
- "P7",
- "16GB",
- "32GB",
- "1TB",
- "2TB",
- "19\"",
- "23\"",
- "Mini Tower",
- "Midi Tower",
- "2 ports",
- "4 ports")
- prices = (100, 120, 200, 75, 150, 50, 100, 65, 120, 40, 70, 10, 20)
- def get_components_sublist(component, case):
- if component == "Processor":
- if case == "upper":
- subcomponents = choices[:3]
- elif case == "lower":
- subcomponents = [processor.lower() for processor in choices[:3]]
- elif component == "RAM":
- if case == "upper":
- subcomponents = choices[3:5]
- elif case == "lower":
- subcomponents = [ram.lower() for ram in choices[3:5]]
- elif component == "Storage":
- if case == "upper":
- subcomponents = choices[5:7]
- elif case == "lower":
- subcomponents = [storage.lower() for storage in choices[5:7]]
- elif component == "Screen":
- if case == "upper":
- subcomponents = choices[7:9]
- elif case == "lower":
- subcomponents = [screen.lower() for screen in choices[7:9]]
- elif component == "Case":
- if case == "upper":
- subcomponents = choices[9:11]
- elif case == "lower":
- subcomponents = [case.lower() for case in choices[9:11]]
- elif component == "USB Ports":
- if case == "upper":
- subcomponents = choices[11:]
- elif case == "lower":
- subcomponents = [usb_port.lower() for usb_port in choices[11:]]
- return subcomponents
- def get_prices_sublist(component):
- if component == "Processor":
- subprices = prices[:3]
- elif component == "RAM":
- subprices = prices[3:5]
- elif component == "Storage":
- subprices = prices[5:7]
- elif component == "Screen":
- subprices = prices[7:9]
- elif component == "Case":
- subprices = prices[9:11]
- elif component == "USB Ports":
- subprices = prices[11:]
- return subprices
- def output_component_info(component, subcomponents, subprices):
- print(component)
- print("Your choices (with prices) are: ")
- for choice, price in zip(subcomponents, subprices):
- print(choice, str(price))
- def main():
- processor_choices = get_components_sublist("Processor", "upper")
- processor_prices = get_prices_sublist("Processor")
- output_component_info("Processor", processor_choices, processor_prices)
- processor_choices = get_components_sublist("Processor", "lower")
Add Comment
Please, Sign In to add comment