Skip to content

NCSU-Libraries/intro-to-prog-py

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

NC State University Libraries Logo

NC State University Libraries Python Workshops

NC State Libraries Workshops Data Science Services GetDataHelp Email: getdatahelp@ncsu.edu Deploy slides to GitHub Pages

Introduction to Programming with Python

Basic Syntax and Operators Open in Colab — Basic Syntax and Operators

Control Flow and Functions Open in Colab — Control Flow and Functions

These materials are used in NC State University Libraries' Data Science Services workshops covering practical data skills (Python, R, visualization, and analysis).


🚀 Quick start

  1. Click a workshop badge above to open in Colab.
  2. Run the install cell when prompted (section below).
  3. Runtime → Restart runtime.
  4. Runtime → Run all. ✅

📘 Included notebooks

  • 🧱 Basic Syntax and Operators — variables, types, lists, dicts, and more.
  • 🔁 Control Flow and Functions — conditionals, loops, functions, and scope.

🧩 Solutions

  • Basic Syntax and Operators — Solutions Open in Colab — Solutions: Basic Syntax and Operators

  • Control Flow and Functions — Solutions Open in Colab — Solutions: Control Flow and Functions

💻 Use on Google Colab

This folder contains Python/Jupyter equivalents of the R workshop notebooks. You can run them directly in Google Colab without installing anything locally.

🔗 Open in Colab

  1. Click a badge above to open directly in Colab.
  2. Prefer to run locally? See the LOCAL.md guide.

Alternatively, in Colab: File → Open Notebook → GitHub tab → paste the repo URL https://github.com/NCSU-Libraries/intro-to-prog-py and select the notebooks in the repository root.

📦 Install dependencies

Run the following cell at the top of each notebook to install exact dependencies compatible with Colab.

!pip -q install -r https://raw.githubusercontent.com/NCSU-Libraries/intro-to-prog-py/main/requirements.txt

Notes:

  • Colab already includes many scientific packages; installing ensures versions match the notebooks.
  • If you fork, adjust the URL above to point to your fork/branch.

💾 Save outputs to Google Drive (optional)

If you want to persist outputs or datasets:

from google.colab import drive
drive.mount('/content/drive')
# e.g., save under /content/drive/MyDrive/intro-to-prog-r/
# e.g., save under /content/drive/MyDrive/intro-to-prog-py/

▶️ Run the notebooks

After installs finish:

  1. Runtime → Restart runtime (recommended) so freshly installed packages are active.
  2. Runtime → Run all.

🛠️ Troubleshooting

  • If a package fails to install, re-run the install cell; transient network issues are common.
  • For large installs, ensure you restarted the runtime before executing the rest of the notebook.
  • If you see import errors, verify the requirements.txt URL matches the branch you want.