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...
IN PYTHON 4) Write an algorithm for a function called add3D which takes 2 parameters: two...
IN PYTHON 4) Write an algorithm for a function called add3D which takes 2 parameters: two different, non-jagged 3D sequences. You may assume that the arrays are the same size and contain compatible types. The function should create a new sequence of the appropriate size, add the two elements at the corresponding spots together, store them in the new 3D array, and return the new 3D array. NOTE: This may be done in pseudo-code or the language of your choice
All these to be done in MATLAB: 1.1)Define a column vector, called “b” in MATLAB that...
All these to be done in MATLAB: 1.1)Define a column vector, called “b” in MATLAB that stored floating point numbers between 0.6 to 2.5 in increment of 0.2. 1.2)What is the size of vector b? How is the size of ‘b’ stored? Define number of rows of ‘b’ in variable ’row’ and number of columns of “b” in variable “col”. 1.3)Define matrix “A” as a 10 by 10 matrix of all “1”s. 1.4)Update matrix “A” as following: set all the...
Python: Write a function called sum_odd that takes two parameters, then calculates and returns the sum...
Python: Write a function called sum_odd that takes two parameters, then calculates and returns the sum of the odd numbers between the two given integers. The sum should include the two given integers, if they are odd. You can assume the arguments will always be positive integers, and the first smaller than or equal to the second. To get full credit on this problem, you must define at least 1 function, use at least 1 loop, and use at least...
This is an intro to Python question: #Write a function called linear() that takes two parameters...
This is an intro to Python question: #Write a function called linear() that takes two parameters #- a list of strings and a string. Write this function so #that it returns the first index at which the string is #found within the list if the string is found, or False if #it is not found. You do not need to worry about searching #for the search string inside the individual strings within #the list: for example, linear(["bobby", "fred"], "bob") #should...
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...
Please use Python 3+ Write a function called let_to_num. It should take a word and encode...
Please use Python 3+ Write a function called let_to_num. It should take a word and encode it into a series of numbers and dashes, with the numbers corresponding to the position of the letter in the alphabet (regardless of casing). If the character is not a letter, then ignore it. Examples of outputs: print(let_to_num('AZ')) # -> 1-26 print(let_to_num('')) # -> (empty string) print(let_to_num('A?Z')) # -> 1-26 print(let_to_num('AZ?')) # -> 1-26 print(let_to_num('AbzC')) # -> 1-2-26-3
Show the Python statement that creates a list called aList and initializes its values to 7,...
Show the Python statement that creates a list called aList and initializes its values to 7, 3, 5, 2, 8, 6. Show the Python statement that would output the first 2 values of aList. You must use the slice operator (the colon). Show the Python statement that would output the last 3 values in aList. You must use the slice operator.
Using K-Map minimize the function: f(x, y, z) = ∑ (0, 2, 5, 7) + d(3,...
Using K-Map minimize the function: f(x, y, z) = ∑ (0, 2, 5, 7) + d(3, 4, 6) Do not use Boolean algebra. Use K-Maps.
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...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT