1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Dmitrij [34]
2 years ago
15

7.5 Code practice Plz answer ASAP

Computers and Technology
1 answer:
stiv31 [10]2 years ago
8 0

def calculate_GPA(grade, weight):

   grades = {"A": 4, "B": 3, "C": 2, "D": 1, "F": 0}

   if weight == 0:

       return grades[grade]

   else:

       return grades[grade] + 1

classes = int(input("How many Classes are you taking? "))

total = 0

for x in range(classes):

   letter = input("Enter your Letter Grade: ")

   user_weight = int(input("Is it weighted? (1 = yes) "))

   grade = calculate_GPA(letter, user_weight)

   total += grade

   print("Your GPA score is: ", grade)

print("Your weighted GPA is a",(total/classes))

I wrote my code in python 3.8. I was able to replicate the output in your picture exactly. If you need me to make any changes, I'll do my best.

You might be interested in
A keyboard would be considered what 2 things
bogdanovich [222]

Answer:

A typing tool and a weapon

Explanation:

8 0
3 years ago
Who found the first computer bug in 1947, and invented the concept of a compiler in 1952
Anastaziya [24]

Grace Hopper is credited with the first documented computer bug. She also devoped the first compiler, while working at Remington in 1952.

3 0
3 years ago
Traffic that is encrypted will typically pass by an intrusion prevention system untouched.a. Trueb. False
Sauron [17]

Answer:

A. True

Explanation:

Data encryption is a technique that converts clear text into unreadable text and transmitted over a network, to prevent attackers from understanding the information send to the receiver, which can only be deciphered by the receiver and the sender with special keys or software.

An intrusion prevention system is used to mitigate cyber attackers by preventing unwanted packets that could be malicious, from entering the network.

The intrusion prevention system can only see clear text data. For this reason, an encrypted text can pass through the prevention system untouched.

3 0
3 years ago
Write a function maxTemp which takes a filename as string argument and returns the maximum temperature as float type for the wee
Alenkinab [10]

Answer:

#section 1

def maxTemp(filename):

   import pathlib

   f = pathlib.Path(filename)

   f.exists()

   if f.exists():

       f = open(filename, "r")

#section 2

       next(f)

       res = [int(sub.split(',')[1]) for sub in f]

       maxdata = (res[0])

       for i in range(len(res)-1):

           if maxdata < res[i]:

               maxdata = res[i]

       

       index = res.index(maxdata)

       f.close()

 #section 3  

       li = []  

       a = open(filename, "r")

       for line in a:

           line = line.strip()

           li.append(line)

   

       

       a.close()

       return (li[index+1])

   else:

       return -1

print(maxTemp("new.csv"))

Explanation:

#section 1:

The function maxTemp is defined. We import pathlib in other to check if the file exists, if it does we carry on with opening the file and if it doesn't the program returns -1.

#section 2:

We start splitting the sub-lists from the second line i.e <em>next(f)</em>. For each line we take the second index element and convert it to an integer.

<em>res = [int(sub.split(',')[1]) for sub in f] </em>

The maximum number is gotten by using the if statement to compare all elements in the list.  The index of the maximum item in the list is collected.

the file is then closed.

#section 3  :

The file is re-opened and all the lines are striped and passed into a new list and the index recovered from section 2, is used to get the day with the highest temperature and the line is returned.

8 0
3 years ago
Choose the output result of the below code.
SIZIF [17.4K]

Answer:

B

Explanation:

When you initialize an instance of FunEvent(tags, year) and assign it to bc. The instance variables in this case are: self.tags = ["g", "ml"] and self.year = 2022. But then you alter tags, which will also change self.tags, since self.tags is a reference to the list you passed in as an argument. This is not the case when you do year=2023 because, first of all, integers are not mutable, and also because even if somehow integers were mutable, you're not changing the object in-place, you're simply changing the where the "variable" is pointing to. So for example if you did tags = ["g", "ml", "bc"] instead of tags.append("bc"), it would also not change the value of the instance variable "tags", because you wouldn't be changing the object in-place. So when you print(bc), the instance variables will be ["g", "ml", "bc"] and 2022. When you try to print an object, it call try to convert it into a string using the __str__  magic method. In this case it will return a string formatted as "Event(tags={self.tags}, year={self.year}) which will output "Event(tags=['g', 'ml', 'bc'], year=2022)" So the correct answer is B

4 0
2 years ago
Other questions:
  • An ethernet switch has a ____ table which is updated by ______.
    14·1 answer
  • Dustin runs a command at the command line trying to find out what kernel version the system is running. However, it doesn't give
    12·1 answer
  • Why is the answer B?
    6·1 answer
  • Hard light is usually not good for filming. True False
    11·2 answers
  • During system testing, developers test the program in an environment that is very similar to how the program will eventually be
    11·2 answers
  • There are many reasons to convert to the decimal numbering system. Select the best answer. When checking numeric values in compu
    5·2 answers
  • Design an Application called Student Course Management create interface called Student Course add an abstract method called ad C
    10·1 answer
  • Which is an example of a demand account
    10·1 answer
  • How to automatically forward text messages to another phone iphone.
    10·1 answer
  • What are the major benefits of preproduction?
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!