Facebook
From Melisa Rebeca, 2 Weeks ago, written in Python.
Embed
Download Paste or View Raw
Hits: 96
  1. def MealsCount(MealOption1, MealOption2):
  2.     MealOption = 0
  3.     MoreMeals = True
  4.     while MoreMeals == True:
  5.         MealOption = int(input())
  6.         if MealOption == 1:
  7.             MealOption1 = MealOption1 + 1
  8.         elif MealOption == 2:
  9.             MealOption2 = MealOption2 + 1
  10.         else:
  11.             print(MealOption1, " ", MealOption2)
  12.             MoreMeals = False
  13.     return MealOption1, MealOption2
  14. #MealsCount(1,4)
  15.  
  16. def RecursiveMealCount(MealOption1, MealOption2):
  17.     MealOption = 0
  18.     MoreMeals = True
  19.     MealOption = int(input())
  20.     if MealOption == 1:
  21.         RecursiveMealCount(MealOption1+1, MealOption2)
  22.     elif MealOption == 2:
  23.         RecursiveMealCount(MealOption1, MealOption2 + 1)
  24.     else:
  25.         print(MealOption1, " ", MealOption2)
  26.         MoreMeals = False
  27. RecursiveMealCount(1,4)