03 Programming in Python 🚀  

Binary Number System

We humans use a decimal, or base-10, numbering system, presumably because people have 10 fingers

 

Early computers were designed around the decimal numbering system. This approach made the creation of computer logic capabilities unnecessarily complex and did not make efficient use of resources. (For example, 10 vacuum tubes were needed to represent one decimal digit.)

 

Story behind

 To deal with the basic electronic states of on and off, Von Neumann suggested using the binary numbering system

Conversions

  • Binary Number to Decimal
  • Decimal Number to Binary

Quiz Time 🔥 

Programming in  Python

Python Interpreter

You write your Python code in a text file with a name like hello.py. How does that code Run?

 

There is program installed on your computer named "python3" or "python", and its job is looking at and running your Python code. This type of program is called an "interpreter".

 


Extra Reading Material [Blog]
How Python Runs

Software Tools [Recommended] 🤔

Python 3

https://www.python.org/download/releases/3.0/

 

 

Jupyter Notebook

https://jupyter.org/install

 

 

Interactive Shell

Command Line 

Installation with pip

If you use pip, you can install it with:

 

pip install notebook

 

Congratulations, you have installed Jupyter Notebook! To run the notebook, run the following command at the Terminal (Mac/Linux) or Command Prompt (Windows):

 

jupyter notebook

 

Juypyter Shortcuts!!!

First Python Program

print("Hello")

First Java Program

Boilerplate Code

//Boilerplate Code
class Main
{
	public static void main (String[] args)
	{	
    		//Your Code goes here
	}
}

Let's learn Python syntax!

 

1. Hello Python

2. Variables & Data types

3. Typecasting

4. Branching

 

Next Class

3. Loops

4. More constructs

Variables & Datatypes

Buckets can have

different Sizes!

Size of a "Bucket"

sys.getsizeof(x)

Read Principal, Rate & Time and print Simple Interest.

Sample Input

P = 100

R = 5

T = 2

 

Sample Output

SI = 10

Simple Interest Calculator

Read 3 Numbers and find their largest.

Sample Input

10

50

40

 

Sample Output

50

Largest of 3 Numbers

Branching

if/else tests - do something under this condtion 

 

Conditional Statements

Single If

marks = 90 


if marks > 90:
	# do some work
	print("Great job")
Made with Slides.com