Skip to content

Instantly share code, notes, and snippets.

View sabareeshkk's full-sized avatar

sabareeshk sabareeshkk

View GitHub Profile
@sabareeshkk
sabareeshkk / attendance_problem.py
Last active April 13, 2022 16:47
In a university, your attendance determines whether you will be allowed to attend your graduation ceremony. You are not allowed to miss classes for four or more consecutive days. Your graduation ceremony is on the last day of the academic year, which is the Nth day.
"""
In a university, your attendance determines whether you will be allowed to attend your graduation ceremony.
You are not allowed to miss classes for four or more consecutive days.
Your graduation ceremony is on the last day of the academic year, which is the Nth day.
Your task is to determine the following:
1. The number of ways to attend classes over N days.
2. The probability that you will miss your graduation ceremony.(ie: last day will be absent)
Represent the solution in the string format as "Answer of (2) / Answer of (1)", don't actually divide or reduce the fraction to decimal