Skip to content
VUBuddy

CS306 Book

Introduction to Python PDF 506 KBUpdated 23 Oct 2026
Quiz CS306 Book PDF 506 KB
vubuddy.com
Type
Quiz
Course
CS306 Introduction to Python
Size
PDF 506 KB
Updated
23 Oct 2026
Free download 0 of 3 used today
Download free · 506 KB

You get 3 free files a day on the website. Add the Chrome extension for 30 a day.

Unlimited downloads in the Android app Get it free on Google Play

Preview text

Text from pages 1, 2, 3 of 96. Download the file for all 96 pages.

Introduction

What are computers?

Talking about general purpose, binary, digital computers Dumb machines that need to be told what to do How do we tell them what to do? By giving them instructions How do we communicate with them? Use special languages such as Assembly, FORTRAN, C, Python etc. What is a program? Precise set of instructions to solve a problems Art of writing these instructions is called programming

Programming Languages

How are instructions written?

Human readable form What are programming languages? Specific languages developed to write computer instructions Some are machine like languages such as assembly or low level languages Others are human readable or high level languages such as FORTRAN, COBOL, C, C++, Python Compiled vs interpreted languages How do we transform a human readable program into machine understandable Compilation vs Interpretation Example: Need to cook meat to eat – compiling, Salad vegetables can be eaten as is - interpreting Language for the course: Python

Why Python is popular

Easy to learn: straightforward syntax and very readable Versatile: can be used for a wide variety of applications, including web development, data analysis, and scientific computing. Automation: powerful tool for automating repetitive tasks, such as file handling, web scraping, and software testing. Machine learning and AI support: popular choice for machine learning, artificial intelligence, and data science. Active community: Python has a large and supportive development community. Vast ecosystem: Python has a large ecosystem of libraries for data processing, machine learning, data science, and more.

Setting up the Python environment on your computer

Go to the official Python website ( Select the latest version of Python Select the " Windows installer" option Click " Download" Run the installer Follow the on-screen instructions Verify the installation by opening a command prompt and typing python -V (or py -V) Run Python and display some interactive commands and results

Setting up VS Code as the preferred editor

Go to the official Visual Studio Code site: Locate the latest version of VS Code for your operating system Download the installer as an .exe file. Install the downloaded file: Run the installer and click Next until you reach Finish. Choose support for Python when prompted

Our first Python program

Open VS Code Type the code Print(“Hello World”) Save as a .py file Run the program highlighting the output Using the Python CLI when needed (will be used in operators module etc.)

Programming Basics

To design a program properly Analyze the problem Express its essence, with examples Formulate statements precisely Evaluate, test and revise if necessary Pay attention to detail

Example program:

Find the weight of metal required to make an annular ring with inner and outer radii 2 cm and 5 cm. The metal sheet has a grammage of 10 gms/cm2. Assume pi=3.14

Walk through analysis, variables, precision, testing etc. (with diagrams)

r=2cm · r=5cm · The program

A1 = 3.14 * 5 * 5

A2 = 3.14 * 2 * 2

A3 = A1 – A2

W = A3 * 10

Writing this program in Python (screen rec.)

A1 = 3.14 * 5 * 5

A2 = 3.14 * 2 * 2

A3 = A1 - A2

W = A3 * 10

print(“The weight of the metal ring is: “, W, “ grams.”)

Python Code: ring.py

A1 = 3.14 * 5 * 5

A2 = 3.14 * 2 * 2

A3 = A1 - A2

W = A3 * 10

print(" The weight of the metal ring is: ", W, " grams.")

Python Code: 1_case_sensitive.py

Case sensitivity

CS306 Introduction to Python All CS306 handouts, past papers, quizzes and MCQs in one place. Open course page

Get more out of VUBuddy, for free

Android app Free on Google Play
  • Unlimited downloads
  • The explanation behind every MCQ answer
  • Study offline on slow data
Get the Android app
Chrome extension Free on the Chrome Web Store
  • 30 downloads a day instead of 3
  • Sign in and buy Pro Semester here
Add to Chrome

One Pro Semester membership works in both the extension and the app.