Quiz on Python Function basics

fill in the blanks to complete the code.

Quiz on Python Function basics

Task 1

function_quiz3
  

Convert a list of farenheits to celsius temperatures

Instructions:

Refresh the page or click solve again if you misplaced any block

temp_farenhite
celsius
[0,20,31,100]
celcius_conversions


def farehnhite_to_celcius(temp_farenhite):
    
      
=[(i *9/5)+32 for i in
      
] return celsius temp_farenhite=
      
celcius_conversions=farehnhite_to_celcius(temp_farenhite) print(
      
)

Output:

[32.0, 68.0, 87.8, 212.0]

Task 2

function_quiz1
  

 You’re tasked with analyzing a list of numbers in Python. Create a function named analyze_numbers that takes a list of numbers as a parameter and returns a dictionary containing the following information: 1. The total number of elements in the list. 2. The sum of all the numbers. 3. The average (mean) of the numbers. 4. The largest number in the list. 5. The smallest number in the list.

Instructions:

Refresh the page or click solve again if you misplaced any block

sum(data)
max(data)
min(data)
analysis
analyze_numbers
[1,23,45,90,105]
/len(data)


import numpy as np
data=
      
def analyze_numbers(data): analysis={"number of elements": len(data), "sum":
      
, "Average": sum(data)
      
, "biggest number":
      
, "smallest number":
      
} return
      
result =
      
(data) print(result)

Output:

{'number of elements': 5, 'sum': 264, 'Average': 52.8, 'biggest number': 105, 'smallest number': 1}

Task 3

function_quiz2
  

Give different grades to a student dependIng on marks they obtained If below 60 then e, between 60 & 70 then E, Between 70 to 80 then D, so upto A with gap of ten ten

Instructions:

Refresh the page or click solve again if you misplaced any block

if
else
def
>60
&
<=
“Your Grade is “
assign_grade
“B”
80


marks=63
      
assign_grade(marks):
      
marks<=60: return "E" elif marks
      
& marks <=70: return "D" elif marks>70
      
marks
      
80: return "C" elif marks>
      
& marks <=90: return
      
      
: return "A" remarks=
      
(marks) print(
      
, remarks)

Output:

Your Grade is  D

How useful was this post?

Click on a star to rate it!

, ,
  • Quiz on Python Function basics

    fill in the blanks to complete the code.

Instagram
WhatsApp
error: Content is protected !!