Question

**Python** Write code that will: Create a list using the following integers: 58, 98, 82, 69,...

**Python**

  1. Write code that will:
  • Create a list using the following integers: 58, 98, 82, 69, 90, 74, 68, 88, 71, 44
  • Sort the list numerically from smallest to largest
  • Iterate through the list that converts from a numerical grade (1-100) to a letter grade (A, B, C, D, F) and print the applicable grade to the console window, but preface each answer with “Your grade is : “ before the letter grade

Homework Answers

Answer #1
lst = [58, 98, 82, 69, 90, 74, 68, 88, 71, 44]
needNextPass = True
k = 1
while k < len(lst) and needNextPass:
    needNextPass = False
    for i in range(len(lst) - k):
        if lst[i] > lst[i + 1]:
            temp = lst[i]
            lst[i] = lst[i + 1]
            lst[i + 1] = temp
            needNextPass = True
for x in lst:
    letter = ''
    if x < 60:
        letter = 'F'
    elif x < 70:
        letter = 'D'
    elif x < 80:
        letter = 'C'
    elif x < 90:
        letter = 'B'
    else:
        letter = 'A'
    print("Your grade is :",letter)

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
Can you write the function in python? def remove_outliers(data, num_outliers): # When analyzing data collected as...
Can you write the function in python? def remove_outliers(data, num_outliers): # When analyzing data collected as a part of a science experiment it # may be desriable to remove the most extreme values before performing # other calculations. Complete this function which takes a list of # values and an non-negative integer, num_outliers, as its parameters. # The function should create a new copy of the list with the num_outliers # largest elements and the num_outliers smallest elements removed. #...
Question 2: Write a C program that read 100 integers from the attached file (integers.txt) into...
Question 2: Write a C program that read 100 integers from the attached file (integers.txt) into an array and copy the integers from the array into a Binary Search Tree (BST). The program prints out the following: The number of comparisons made to search for a given integer in the BST And The number of comparisons made to search for the same integer in the array Question 3 Run the program developed in Question 2 ten times. The given values...
Write an append function void append(const arrayListType<elemType>& otherList) that will take an array list as a...
Write an append function void append(const arrayListType<elemType>& otherList) that will take an array list as a parameter and append it to the current list. Write an operator+ function that will create a new list containing the contents of the two lists added. arrayListType<elemType> operator+(const arrayListType<elemType> & rhs) const so that you can write code like a = b + c where a b and c are all arrayListTypes. Add your functions to the template and write a main program to...
please write the code in java so it can run on jGRASP import java.util.Scanner; 2 import...
please write the code in java so it can run on jGRASP import java.util.Scanner; 2 import java.io.*; //This imports input and output (io) classes that we use 3 //to read and write to files. The * is the wildcard that will 4 //make all of the io classes available if I need them 5 //It saves me from having to import each io class separately. 6 /** 7 This program reads numbers from a file, calculates the 8 mean (average)...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT