Question

Using Python Define a function called to find the level of quality: if quality= 3 or...

Using Python
Define a function called to find the level of quality:
if quality= 3 or 4, quality_level=poor
if quality= 5 or 6, quality_level=fair
if quality=7 or 8, quality_level=good
then use the map function find the corresponding quality level for the quality,
add the new column to a data frame

Homework Answers

Answer #1
import pandas as pd 
lst = []

num = int(input("Enter a Quality Level: "))
if (num ==3 or num ==4): 
    print("Quality Level is POOR")
    
if (num ==5 or num ==6):
        print("Quality Level is FAIR")
        
if (num ==7 or num ==8):
        print("Quality Level is GOOD")

for i in range(0, num): 
    ele = int(input()) 
  
    lst.append(ele)
      
print(lst)

Thank you

Happy learning

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
PYTHON population_file = open('populations.txt') # 1. Define a variable called total_population, assign 0 to this variable...
PYTHON population_file = open('populations.txt') # 1. Define a variable called total_population, assign 0 to this variable for line in population_file.readlines(): # 2. Add line to the total_population, convert line to an int first # 3. Close the population_file using the close() method total_population_file = open('total_population.txt', 'w') # 4. Use the write() method to write the total_population to the total_population_file. Convert total_population to a string # 5. Close the total_population_file using the close() method Require 1.Program creates a new file called...
Problem 2: Python 3 Implement a function called gee_whiz that does the following: given argument n,...
Problem 2: Python 3 Implement a function called gee_whiz that does the following: given argument n, a positive integer, it returns a list of n tuples corresponding to the numbers 1 through n (both inclusive): the tuple for the number k consists of k as the first component, and exactly one of the following strings as the second: • the string 'two!' if k is divisible by 2 • the string 'three!' if k is divisible by 3 • the...
Using C programming Create a function called printMenu( ) with the following properties: Has no function...
Using C programming Create a function called printMenu( ) with the following properties: Has no function inputs or output. Prints the following menu to the screen: 1. Enter user name. 2. Enter scores. 3. Display average score. 4. Display summary. 5. Quit Create a function called printLine( ) with the following properties: Takes as input a char Takes as input an integer corresponding to the number of times to print the character Has no function output. For example, if we...
Create a function called, convert. This function receives a string parameter called word which only contains...
Create a function called, convert. This function receives a string parameter called word which only contains digits (the string represents a positive number) and returns a list of numbers. This is how the function works: - This function calculates the number of times each digit has repeated in the input string and then generates a number based on that using the following formula and adds it to a list. For instance, if the digit x has been repeated n times,...
Assume 46 percent of data scientists prefer R to Python for predictive modeling. If a sample...
Assume 46 percent of data scientists prefer R to Python for predictive modeling. If a sample of 450 data scientists are selected, find the probability that at least 200 prefer R to Python by the following steps: Step 1 Determine p and n: Step 2 Find the mean, µ. Step 3 Find σ2 and σ. Step 4 Write the binomial probability statement we are evaluating. Step 5 Rewrite the statement from Step 4 using the continuity correction factor. Step 6...
1- If ?(?)=3?5?+29?5?+1 find the inverse function. 2- State the domain of the function ?(?)=8?−94? 3-...
1- If ?(?)=3?5?+29?5?+1 find the inverse function. 2- State the domain of the function ?(?)=8?−94? 3- State the domain of the function ?(?)=5?−83?+5 in interval notation 4- State the domain of the function ?(?)=7?−8?−3 in interval notation. 5- State the domain of the function ?(?)=9?+1?2−3?−40 in interval notation 6- State the domain of the function ?(?)=8?+13?2−11?+8 in interval notation. 7- State the domain of the function ?(?)=8?−39?2+12?+13 in interval notation.
Chapter 11: Using the attached dataset “Chapter 11 Data Set 1” to test the research hypothesis...
Chapter 11: Using the attached dataset “Chapter 11 Data Set 1” to test the research hypothesis that males raise their hands in class more often than females. (Please note that these data are not exactly the data provided by the author). Is this a directional or non-directional hypothesis? Should you use a one-tailed or two-tailed test? What is the corresponding null hypothesis? Conduct the between groups t-test using Excel (either method). Use the .05 confidence level. What is your conclusion...
Chapter 11: Using the attached dataset “Chapter 11 Data Set 1” to test the research hypothesis...
Chapter 11: Using the attached dataset “Chapter 11 Data Set 1” to test the research hypothesis that males raise their hands in class more often than females. (Please note that these data are not exactly the data provided by the author). Is this a directional or non-directional hypothesis? Should you use a one-tailed or two-tailed test? What is the corresponding null hypothesis? Conduct the between groups t-test using Excel (either method). Use the .05 confidence level. What is your conclusion...
readCSV Define the function readCSV(filename)to so it reads the contents of the CSV file named filename...
readCSV Define the function readCSV(filename)to so it reads the contents of the CSV file named filename and returns a list of dictionaries corresponding to its contents. The CSV file will have a header file with field names. Each dictionary in the returned list of dictionaries must consist of key-value pairs where the key is a field name. The field name must be paired with the corresponding data value from the record. For example, if sample.csv contains: a,b,c 1,2,3 4,5,6 7,8,9...
python If a number num1 divides another number num2 evenly then num1 is a divisor of...
python If a number num1 divides another number num2 evenly then num1 is a divisor of num2. For example, 2 is a divisor of 2, 4, 6, 8, but 2 is not a divisor of 1, 3, 5, 7, 9, 11, 13. Write a function named count_divisors(m,n) that works as follows. Input: the function takes two integer arguments m and n Process: the function asks the user to enter numbers (positive or negative), and counts the total number of inputs...