QuestionQuestion

1. Based on the information on catalog pages, write a Python class, called Course, which stores all of the relevant information about a course taught at OSU. Add in any functions that you think are useful for this class. Be sure to define __str__ :
print(c)
ME 451: INTRODUCTION TO INSTRUMENTATION AND MEASUREMENT SYSTEMS

2. Write a function, called scrape_course ,that gets information from the OSU catalog, and returns a Course instance. We should be able to run it like this:
c = scrape_course('ME', 451, 'W18')
print(c)
ME 451: INTRODUCTION TO INSTRUMENTATION AND MEASUREMENT SYSTEMS

3. Verify that your code works for the Fall 2018 instance of ME 451, and collects the correct information.
Then, try it for the Fall instance of ROB 514. Then try some other classes. You should write test code to verify that you're collecting the correct information, for a few classes.

Solution PreviewSolution Preview

These solutions may offer step-by-step problem-solving explanations or good writing examples that include modern styles of formatting and construction of bibliographies out of text citations and references. Students may use these solutions for personal skill-building and practice. Unethical use is strictly forbidden.

import requests
from bs4 import BeautifulSoup

class Dollars:
    rates = None
   
    def __init__(self, dollars=0, cents=0):
       self.pennies = int(dollars * 100) + int(cents)
   
       # Get today's exchange rates, if we don't already have them
       if Dollars.rates == None:         
            Dollars.get_forex_rates()
      
    def __str__(self):
       return '{0}${1}.{2:02}'.format('-' if self.pennies < 0 else '',
            int(abs(self.pennies / 100)), abs(self.pennies) % 100)
      
    def __repr__(self):
       return self.__str__()
   
    def __add__(self, other):
       try:
            return Dollars(cents=self.pennies + other.pennies)
       except:
            return self + Dollars(other)
   
    def __radd__(self, other):
       return self.__add__(other)
   
    def __sub__(self, other):
       return self + -other

    def __rsub__(self, other):
       return other - self
   
    def __neg__(self):
       return Dollars(cents=-self.pennies)...

By purchasing this solution you'll be able to access the following files:
Solution.zip.

$10.00
for this solution

or FREE if you
register a new account!

PayPal, G Pay, ApplePay, Amazon Pay, and all major credit cards accepted.

Find A Tutor

View available Python Programming Tutors

Get College Homework Help.

Are you sure you don't want to upload any files?

Fast tutor response requires as much info as possible.

Decision:
Upload a file
Continue without uploading

SUBMIT YOUR HOMEWORK
We couldn't find that subject.
Please select the best match from the list below.

We'll send you an email right away. If it's not in your inbox, check your spam folder.

  • 1
  • 2
  • 3
Live Chats