Friday, December 29, 2023

Euro Millions chooser OOP V1.35

import random 
class EuroMillions:
  """Generates a random EuroMillions ticket with no duplicate numbers."""

  def __init__(self):
    self.main_draw_numbers = range(1, 51)
    self.selected_numbers = []
    self.lucky_star_numbers = range(1, 13)

  def generate_numbers(self):
    while len(self.selected_numbers) <5:
      number = random.choice(self.main_draw_numbers)
      if number not in self.selected_numbers:
        self.selected_numbers.append(number)

    self.lucky_star_numbers = random.sample(self.lucky_star_numbers, 2)

  def get_numbers(self):
    return self.selected_numbers, self.lucky_star_numbers

class Dinner:
  """Selects a random dinner option."""

  def __init__(self):
    self.choices = ["Indian","Italian","Chinese","Mexican","Thai","French","Barbeque","Roast","Something Else"]

  def select_dinner(self):
    return random.choice(self.choices)

def main():
  euromillions = EuroMillions()
  euromillions.generate_numbers()

  dinner = Dinner()
  dinner_choice = dinner.select_dinner()

  if dinner_choice == "Barbeque":
    print("Your EuroMillions numbers are: Have a BBQ Tonight!!", euromillions.get_numbers())
    print("If you are lucky enough to Win donations are accepted at the following Bitcoin Address:")
    print("3Fa1XtwRM9v8qpwTwUHguAGNWBB9ETUJn4")
    print("Good Luck!!")
  elif dinner_choice == "French":
    print("but you won't be having a BBQ tonight!","instead you will be having a", dinner_choice, "dinner")
  elif dinner_choice == "Roast":
    print("but you won't be having a BBQ tonight!","instead you will be having a", dinner_choice, "dinner")
  else:
    print("but you won't be having a BBQ tonight!","instead you will be having", dinner_choice)

if __name__ == "__main__":
  main()

No comments:

Post a Comment

Gammon => Ham Calculator V1.0

def ham_cooking_time (grams): """ Calculates the cooking time for a ham based on its weight. Args: g...