# -*- coding: utf-8 -*-
"""
Created on Wed Dec 22 09:39:48 2021

@author: TANISH
"""


""" If - Else """

# If - Else functionality helps us to alter / modify / generate
# output based on some conditions that are to be satisfied

# For eg.
# How does a software decides to print "P" or "F" in
# the exam result letter of an Actuarial Exam?

# How do we make decision whether to Accept / Reject H0?


# Syntax for If - Else:
# if <condition> :
#    <block of codes>
# else:
#    <block of codes>


# Syntax for If - Else If:
# if <condition-1> :
#    <block of codes>
# elif <condition-2> :
#      <block of codes>
#       .
#       .
#       .
# elif <condition-n> :
#      <block of codes>
# else:
#    <block of codes>


# Eg.
# The Actuarial exam committee decides that the pass mark
# for CM1 will be 62.
# Write down the grade which will printed in the
# exam result letter

marks_scored = (float(input("Enter the marks scored by the student : ")))
passing_mark = (int(input("Enter the Pass Mark for CM1 : ")))

# Interpretation for input():
# input() allows to take data from the user
# That is we get, User-input data via keyboard

if marks_scored >= passing_mark:
    print("Grade: P"," Marks = ",marks_scored)
else:
    print("Grade: F"," Marks = ",marks_scored)


# Now the committee decides if any one is on the border line
# their paper needs to be rechecked
# Tag their Grade Status appropriately now...

if marks_scored >= (passing_mark + 2):
    print("Grade: P"," Marks = ",marks_scored)
elif marks_scored <= (passing_mark - 2):
    print("Grade: F"," Marks = ",marks_scored)
else:
    print("Grade: Re"," Marks = ",marks_scored)


# Alternative
if  (marks_scored - passing_mark) >= 2:
    print("Grade: P"," Marks = ",marks_scored)
elif (marks_scored - passing_mark) <= (-2):
    print("Grade: F"," Marks = ",marks_scored)
else:
    print("Grade: Re"," Marks = ",marks_scored)


# Alternative:
if marks_scored >= (passing_mark + 2):
    print("Grade: P"," Marks = ",marks_scored)
elif ((passing_mark - 1) <= marks_scored <= (passing_mark + 1)):
    print("Grade: Re"," Marks = ",marks_scored)
else:
    print("Grade: F"," Marks = ",marks_scored)

    
# Eg.
# For a Simple Linear Regression Model, we test
# H0: B1 = 0     v/s     H1: B1 != 0

test_statistic = 1.645
t_tab = 2.340

if abs(test_statistic) > t_tab:
    print("Reject H0")
else:
    print("Do Not Reject H0")


# Nested If - Else

# Eg.
# Classify the Distribution as Continuos / Discrete
# Also tell whether it is Symmetric or Not irrespective 
# of parameters

distribution = str(input("Enter a Dsitrbituion name in ALL CAPS : "))


if distribution in ["NORMAL","BETA-1","GAMMA","STUDENTS-T"]:
    if distribution in ["NORMAL","STUDENTS-T"]:
        print("Continous and Symmetric")
    else:
        print("Continous and Unsymmetric")
elif distribution in ["BINOMIAL","POISSION","GEOMETRIC"]:
        print("Discrete and Unsymmetric")
else:
    print("Unidentified Distribution")


# Keyword "in":
# It provides a boolean value as to whether or not
# The LHS value of the "in" is present on the
# RHS (List, Tuple, A single value etc...)

# Eg.
1 in [1,2,3,4,5]
"1" in [1,2,3,4,5]


""" Exercise """

# Q1.
# The Actuarial Society decides to declare only the grades,
# instead of marks
# And the students who have the grade "F" will be given another
# grade based on how close the score was to the passing mark

# F-Grade sheet:
# 5 marks less = A
# 10 marks less = B
# More than 10 marks less = C

# Answer:

marks_scored = (float(input("Enter the marks scored by the student : ")))
passing_mark = (int(input("Enter the Pass Mark for CM1 : ")))

if marks_scored >= passing_mark:
    print("Grade: P")
else:
    if abs(marks_scored - passing_mark) <= 5:
        print("Grade: F - A")
    elif abs(marks_scored - passing_mark) <= 10:
        print("Grade: F - B")
    else:
        print("Grade: F - C")


""" Change Working Directory """

import os

# To CHANGE working directory
os.chdir(r"Path")

# To KNOW the current working directory
os.getcwd()
