0
month = input()
nights_count = int(input())

studio_pr = 0
apartment_pr = 0

if month == "May" or "October":
    studio_pr = nights_count * 50
    apartment_pr = nights_count * 65
    if 14 == nights_count > 7:
        studio_pr = studio_pr * 0.95
    elif nights_count > 14:
        studio_pr = studio_pr * 0.70
        apartment_pr = apartment_pr * 0.9
elif month == "June" or "September":
    studio_pr = nights_count * 75.20
    apartment_pr = nights_count * 68.70
    if nights_count > 14:
        studio_pr = studio_pr * 0.8
        apartment_pr = apartment_pr * 0.9
elif month == "July" or "August":
    studio_pr = nights_count * 76
    apartment_pr = nights_count * 77
    if nights_count > 14:
        apartment_pr = apartment_pr * 0.9
print(f"Apartment: {apartment_pr:.2f}")
print(f"Studio: {studio_pr:.2f}")

The code calculate the first condition, even if the month is August or June Some help here :D

I expected this: Input:June 14 Output: Apartment: 961.80 lv. Studio: 1052.80 lv. but the code outputs the result for May 14

Cryptopian
  • 19
  • 2
  • 1
    *`month == "May" or "October"`* - this is not how `or` works. By the way this *`if 14 == nights_count > 7`* feels weird too – Rafalon Dec 12 '22 at 16:42
  • if 14 == nights_count > 7 ..... Yes I know its strange, but I was thinking first there is mistake on calculations, after debuger I found it misses , and do some weird changes haha. I;ve made the conditions like this : if month == "May" or month == "October": AND now it works – Cryptopian Dec 12 '22 at 16:50
  • if 7 < nights_count < 15: this works for the code. – Cryptopian Dec 12 '22 at 18:53

0 Answers0