OIM3600 - Computer Science for Business Students

Session 16 (10/23)

contain

Today's Agenda

  • Welcome/News/Announcements
  • Class Review
  • Revisit Homework
  • Lectures

Welcome/News/Announcements

  • Homework - Algorithms: due 10/26, Saturday
  • Homework feedback is provided in your GitHub issues or via PR.
    • Please respond.
  • Make sure you understand the code you use in your exercises and homework.
    • i.e. I may ask you to come to my office and explain any code that looks "interesting".
  • Communications:
    • Slack - for debugging, clarifications, real-time discussion, casual chat, etc.
    • Email - specify course # in subject title, e.g., "OIM3600: GitHub settings"
    • Meet with me in person during office hours at least once this semester.
  • Questions?

Midterm Feedback Survey Results (anonymized)

  • Link on Canvas - Week 8

What we have learned so far

  • Code represent: 🔠🔢🈶😂🟥🟩🟦🖼 📽 🎼
  • Programming Tools: VSCode, Git/GitHub
  • Programming Basics:
    • Variables, Expressions, Statements
    • Types: int, float, str, bool, None, list, dict, tuple, set
    • Functions, Conditional, Iterations
  • Algorithms
    • Searching
    • Sortings: selection sort, bubble sort, merge sort (recursive)
  • API

Why API?

API (Application Programming Interface)

API Example: OpenWeather

  • Get an API key from https://openweathermap.org/api
  • Download the sample code, weather.py, from resources/code
  • Use the urllib.request library to send HTTP requests to the OpenWeather API and retrieve data in JSON format
  • Remember to protect sensitive data (e.g., API keys, API tokens, passwords)
    • Create .env file and store your API key, e.g., OPENWEATHER_API_KEY=...
    • Install python-dotenv in Terminal: python -m pip install python-dotenv
    • import os
      from dotenv import load_dotenv
      
      load_dotenv()
      APIKEY = os.getenv("OPENWEATHER_API_KEY")
      
    • Add .env to the .gitignore to prevent committing it to a public repository.

Recommendations on API

Revisit Homework

Lecture