---
# System prepended metadata

title: Arogya Setu v2.0

---

# Arogya Setu v2.0

India needs help and you have been hired to make the process of checking vaccination eligibility faster so high risk groups are treated sooner.

Unfortunately, all details are collected manually at the moment in the local Municpal office. Let's see if we can make things easier.

WAP to get the following input from the user and print it out to the user to confirm the details.

This will be shown on the screen to the user when they come to the office.

## Examples of console interactions

### Example 1
```
What is your name?
Karl Max
How old are you?
60
How many doses of the vaccination have you had already?
1
### Your Details ###
Name: Karl Marx
Age: 60 
Dose(s) Received: 1
Thank you! We are checking your elibility and will inform you soon by email.
```

### Example 2
```
What is your name?
Anne Frank
How old are you?
13
How many doses of the vaccination have you had already?
0
### Your Details ###
Name: Anne Frank
Age: 13
Dose(s) Received: 0
Thank you! We are checking your elibility and will inform you soon by email.
```


## Your Code

No worries I've copy pasted your code from the [replit](https://replit.com/@larrydalmeida/AdmiredLavenderBrains#main.py)

Understand every line of this before you move on to the next exercise.

```lang-py
def get_input(message):
  print(message)
  val = input()
  return val


name = get_input('What is your name?')
age = get_input('What is your age?')
doses = get_input('How many doses of the vaccination have you had already?')
message = 'Thank you! We are checking your elibility and will inform you soon by email.'

print ('### Your Details ###')
print ('Name: ' + name)
print ('Age : ' + age)
print ('Dose(s) Received : ' + doses)
print(message)
```

# Arogya Setu v2.1

That was awesome! 

Your colleagues love it because it reduces the need to understand handwritten forms and manually check for eligibility.

But we still manually check each form for the applicant's elligibilty to receive the vaccination.

According to Maharashtra's Ministry of Health any person of age 60 or above is eligible for the vaccination.

- [ ] Write a function called `is_elligible` which accepts an `age` parameter and returns `True` **if** the person is of elligible age and `False` otherwise.
- [ ] Use that function to print the eligibility message.
- [ ] Write a function called `get_elligibility_message` that accepts a `elligibility_status` parameter and returns the message `You are elligible to receive a vaccination and may visit any Government hospital to get it.` if `elligibility_status` is `True` or return `Unfortunately, you are not elligible to receive the vaccination.` otherwise.

*Be sure to copy paste your previous solution and include it here too.*

## Examples of console interactions

### Example 1
```
What is your name?
Karl Max
How old are you?
60
How many doses of the vaccination have you had already?
1
### Your Details ###
Name: Karl Marx
Age: 60 
Dose(s) Received: 1
You are elligible to receive a vaccination and may visit any Government hospital to get it.
```

### Example 2
```
What is your name?
Anne Frank
How old are you?
13
How many doses of the vaccination have you had already?
0
### Your Details ###
Name: Anne Frank
Age: 13
Dose(s) Received: 0
Unfortunately, you are not elligible to receive the vaccination.
```

## Your Code

```lang-py
# code from previous exercise
def get_input(message):
  print(message)
  val = input()
  return val


# define `is_elligble` here
def is_eligible(age):
    if int(age) > 60:
        return 'True'
    else:
        return 'False'


# define `get_elligibility_message` here
def get_elligibility_message (elligibility_status):
    if is_eligible(age) == 'True':
      return 'You are elligible to receive a vaccination and may visit any Government hospital to get it.'
    else:
      return 'Unfortunately, you are not elligible to receive the vaccination.'



name = get_input('What is your name?')
age = get_input('What is your age?')
doses = get_input('How many doses of the vaccination have you had already?')
# elligibility_status = Complete this code...
# message = Complete this code...


print ('### Your Details ###')
print ('Name: ' + name)
print ('Age : ' + age)
print ('Dose(s) Received : ' + doses)
print(message)
```


```lang-py
def get_input(message):
  print(message)
  val = input()
  return val


name = get_input('What is your name?')
age = get_input('What is your age?')
doses = get_input('How many doses of the vaccination have you had already?')
message = 'Thank you! We are checking your elibility and will inform you soon by email.'

def if_eligible(x):
          if int(age) > 60:
            return 'You are elligible to receive a vaccination and may visit any Government hospital to get it.'
          else:
            return 'Unfortunately, you are not elligible to receive the vaccination.'

print ('### Your Details ###')
print ('Name: ' + name)
print ('Age : ' + age)
print ('Dose(s) Received : ' + doses)
print(if_eligible(age))
```
# Arogya Setu v2.2

Great job!

But right now our program is kind of dumb. 

It doesn't check if the person has already received the second dose and returns `True` for anyone above age 60 including those who have already taken 2 doses and don't need a vaccination.

- [ ] Update the `is_elligible` to also accept a `doses` parameter and return `True` **only if** the person is of elligible age **and** has taken only 1 dose, otherwise `False`.

*Be sure to copy paste your previous solution and include it here too.*

## Examples of console interactions

### Example 1
```
What is your name?
Karl Max
How old are you?
60
How many doses of the vaccination have you had already?
1
### Your Details ###
Name: Karl Marx
Age: 60 
Dose(s) Received: 1
You are elligible to receive a vaccination and may visit any Government hospital to get it.
```

### Example 2
```
What is your name?
Simone Dubois
How old are you?
63
How many doses of the vaccination have you had already?
2
### Your Details ###
Name: Simone Dubois
Age: 63 
Dose(s) Received: 2
Unfortunately, you are not elligible to receive the vaccination.
```

### Example 3
```
What is your name?
Anne Frank
How old are you?
13
How many doses of the vaccination have you had already?
0
### Your Details ###
Name: Anne Frank
Age: 13
Dose(s) Received: 0
Unfortunately, you are not elligible to receive the vaccination.
```

## Your Code
```lang-py
def get_input(message):
    print(message)
    val = input()
    return val


name = get_input('What is your name?')
age = get_input('What is your age?')
doses = get_input('How many doses of the vaccination have you had already?')
message = 'Thank you! We are checking your elibility and will inform you soon by email.'


def is_eligible(age_dose):
    if int(age) > 60 and int(doses) < 2:
        return 'True'
    else:
        return 'False'


def get_elligibility_message(elligibility_status):
    if is_eligible(age) == 'True':
        return 'You are elligible to receive a vaccination and may visit any Government hospital to get it.'
    else:
        return 'Unfortunately, you are not elligible to receive the vaccination.'


print('### Your Details ###')
print('Name: ' + name)
print('Age : ' + age)
print('Dose(s) Received : ' + doses)
print(get_elligibility_message(is_eligible))
```


# Arogya Setu v3.0

Mind blown! 

It works excellently and you tweet about it. It gets retweeted and Modi tweets back!

He wants you to enable support for Gujarat too.

Gujarat however has a different elligibilty criteria. There the minimum age is 52.

- [ ] Update your program to ask the user for their current state of residence
- [ ] Add a function called `get_elligibility_by_state` that accepts a `state` parameter. If the provided `state` is `Mumbai` return `60` otherwise return Gujarat's minimum age.
- [ ] Update `is_elligible` to also accept a `state` parameter and return `True` **only if** the person is of elligible age based on the minimum age set by the state they reside in **and** has taken only 1 dose, otherwise `False`. 

*Be sure to copy paste your previous solution and include it here too.*

## Examples of console interactions

### Example 1
```
What is your name?
Karl Max
How old are you?
60
How many doses of the vaccination have you had already?
1
Which state do you reside in?
Maharashtra
### Your Details ###
Name: Karl Marx
Age: 60 
Residence: Maharashtra
Dose(s) Received: 1
You are elligible to receive a vaccination and may visit any Government hospital to get it.
```

### Example 2
```
What is your name?
Simone Dubois
How old are you?
63
How many doses of the vaccination have you had already?
2
Which state do you reside in?
Gujarat
### Your Details ###
Name: Simone Dubois
Age: 63 
Residence: Gujarat
Dose(s) Received: 2
Unfortunately, you are not elligible to receive the vaccination.
```

### Example 3
```
What is your name?
John Locke
How old are you?
53
How many doses of the vaccination have you had already?
0
Which state do you reside in?
Gujarat
### Your Details ###
Name: John Locke
Age: 53
Residence: Gujarat
Dose(s) Received: 0
You are elligible to receive a vaccination and may visit any Government hospital to get it.
```

## Your Code

```lang-py
def get_input(message):
    print(message)
    val = input()
    return val


name = get_input('What is your name?')
age = get_input('What is your age?')
doses = get_input('How many doses of the vaccination have you had already?')
residence = get_input('Which state do you reside at?')
message = 'Thank you! We are checking your elibility and will inform you soon by email.'


def is_eligible(age_dose):
    if int(age) > 59 and int(doses) < 2:
        return 'True'
    else:
        return 'False'

def get_elligibility_by_state(residence):
    if residence == 'Gujrat' and int(age) > 51:
      return 'True'
    else:
      return 'False'

def get_elligibility_message(elligibility_status):
    if is_eligible(age) == 'True' and get_elligibility_by_state(residence) == 'True':
        return 'You are elligible to receive a vaccination and may visit any Government hospital to get it.'
    else:
        return 'Unfortunately, you are not elligible to receive the vaccination.'


print('### Your Details ###')
print('Name: ' + name)
print('Age : ' + age)
print('Dose(s) Received : ' + doses)
print ('Residence: ' + residence)
print(get_elligibility_message(is_eligible))
print(get_elligibility_message(get_elligibility_by_state))
```