Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- day = input()
- if day == 'Monday' or day == 'Tuesday' or day == 'Wednesday' or day == 'Thursday' or day == 'Friday':
- print('Working day')
- elif day == 'Saturday' or day == 'Sunday':
- print('Weekend')
- else:
- print('Error')
- Или така:
- day = input()
- if day in ('Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday'):
- print('Working day')
- elif day in ('Saturday', 'Sunday'):
- print('Weekend')
- else:
- print('Error')
- Решение с тернарен оператор:
- day = input()
- print('Working day' if day in ('Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday')
- else 'Weekend' if day in ('Saturday', 'Sunday') else 'Error')
- Решение с масив:
- day = input()
- working_day = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday']
- weekend = ['Saturday', 'Sunday']
- print('Working day' if working_day.__contains__(day) else 'Weekend' if weekend.__contains__(day) else 'Error')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement