<jupyter_start><jupyter_text>Assignment 2(assignment means need to submit one ah :))Due: Typically a day before the following CTCUC session. Early and quality submissions earn bonus credit. :) We have previously looked at how to compute body mass index (BMI) for adults.In this assignment we are interested in BMI calculation for children (ages 2 to 19).References:- https://www.cdc.gov/healthyweight/assessing/bmi/childrens_bmi/about_childrens_bmi.html- https://www.cdc.gov/healthyweight/bmi/calculator.html- https://www.cdc.gov/healthyweight/assessing/bmi/childrens_bmi/tool_for_schools.htmlIn Coursemology, create an assessment with 3 or more autograded programming questions which will illustrate the understanding and application of Python concepts and skills you have learned thus far (or more).You can/should test out your functions here in Google Colab before transferring / adapting them to Coursemology. In the process, you will learn about the pros and cons of Google Colab and Coursemology as teaching and learning aids.The following are some preliminary examples. Do not treat them as model samples. Where necessary, adapt the scenarios to your students' learning and assessment contexts.Record a session of how you would teach ONE autograded problem. Submit this to Session 3 feedback (when you are ready). Write program code to receive the weights (in kg) of high school students until the user enters -1. Store the weights in an array / Python list.<jupyter_code>weight = []

wt = float(input('Enter weight of student, in kg: '))

while wt != -1:
    weight.append(wt)
    wt = float(input('Enter weight of next student, in kg: ')) 

print (weight)<jupyter_output>Enter weight in kg: 34
Enter weight for next student, in kg: 54
Enter weight for next student, in kg: 92
Enter weight for next student, in kg: -1
[34.0, 54.0, 92.0]<jupyter_text>Write program code to receive the heights (in cm) of high school students until the user enters -1. Store the heights in an array / Python list.<jupyter_code>height = []

ht = int(input('Enter height of student, in cm: '))

while ht != -1:
    height.append(ht)
    ht = int(input('Enter height of next student, in cm: ')) 

print (height)<jupyter_output>Enter height in cm: 145
Enter height for next student, in cm: 175
Enter height for next student, in cm: -1
[145, 175]<jupyter_text>Write program code to receive the genders ('m' or 'f') of high school students until the user enters -1. Store the genders in an array / Python list.<jupyter_code>gender = []

gen = input('Enter gender of student (m or f): ')

while gen != -1:
    if (gen == 'm') or (gen == 'f'):
        gender.append(gen)
        gen = input('Enter gender of next student (m or f): ')
    else:
        print ('Invalid gender!')
        break

print (gender)<jupyter_output>Enter gender (m or f): m
Enter gender for next student (m or f): f
Enter gender for next student (m or f): 4
Invalid gender!
['m', 'f']<jupyter_text>Write program code to receive the ages of high school students until the user enters -1. Store the ages in an array / Python list.<jupyter_code>age = []

a_input = int(input('Enter age of student, in years: '))

while a_input != -1:
    age.append(a_input)
    a_input = int(input('Enter age of next student, in years: ')) 

print (height)<jupyter_output><empty_output><jupyter_text>Write program code to compute the BMI of a child/teen.<jupyter_code>def compute_bmi(weight, height):
    return round((weight / (height**2)) * 10000, 2)

compute_bmi(70, 175)<jupyter_output><empty_output><jupyter_text>Write program code to validate the weight/height/gender/age of a child/teen.<jupyter_code>def validate( age):
    if 2 <= age <= 19:
          return True
    else: 
        return False<jupyter_output><empty_output><jupyter_text>**Coursemology Questions** Q1 - BMI Calculator<jupyter_code>def bmi_calc (weight, height):
    bmi = []
    for i in range (len(weight)):                  #loop for the number of entries in each list
        calc = round ( weight[i] / (height[i] ** 2), 1)  #calculate bmi
        bmi.append(calc)                        #append calculated bmi to the list of bmis.
    return bmi

#main
wt = [54, 42]
ht = [1.65, 1.55]

bmi_calc(wt, ht)
def bmi_calc (weight, height):
    bmi = []
    for w, h in zip(weight, height):                  #loop for the number of entries in each list
        calc = round ( w / (h ** 2), 1)               #calculate bmi
        bmi.append(calc)                              #append calculated bmi to the list of bmis.
    return bmi

#main
wt = [54, 42]
ht = [1.65, 1.55]

bmi_calc(wt, ht)<jupyter_output><empty_output><jupyter_text>Q2 - Weight Status<jupyter_code>def weight_status(bmi):
    if bmi > 22.0:
        return 'Obese'
    elif bmi > 19.5:              #and less than 22
        return 'Overweight'
    elif bmi > 14.2:              #and less than 19.5
        return 'Healthy Weight'
    else:
        return 'Underweight'

#main
weight_status(19.5)<jupyter_output><empty_output><jupyter_text>Q3 - Dictionary of student details<jupyter_code>def student_profile(first_name, last_name, weight, height, age):

    #check if height is passed in centimetres
    if 100 < height < 250:
        height = height / 100    
    
    details = {
        'name': first_name.capitalize() + ' ' + last_name.capitalize(),
        'weight': round(weight, 1),
        'height': round(height, 2),
        'age': round(age)
        }
    return details

student_profile('rob', 'Stark', 66.789, 170, 14.7)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.10072202166064982, 'fraction_numerical': 0.02256317689530686, 'mean_word_length': 3.4257188498402558, 'pattern_counts': {'":': 0, '<': 38, '<?xml version=': 0, '>': 37, 'https://': 3, 'lorem ipsum': 0, 'www.': 3, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '9', 'dir': 'jupyter-structured-clean-dedup', 'id': '608330', 'license': 'MIT', 'n_tokens_mistral': 1822, 'n_tokens_neox': 1686, 'n_words': 652, 'path': 'JJ_Cheung_CTCUC22Assignment02.ipynb', 'repo_name': 'jjcheung/ctcuc22', 'size': '5540'}