Python 1
Python 1
Week-1: Notes
What is Python?
Python is a popular programming language. It was created by Guido van Rossum, and released
in 1991.
It is used for:
web development (server-side) and software development
mathematics
system scripting
Why Python?
Python works on different platforms (Windows, Mac, Linux, Raspberry Pi, etc).
Python has syntax that allows developers to write programs with fewer lines than some
other programming languages.
Python runs on an interpreter system, meaning that code can be executed as soon as it is
written. This means that prototyping can be very quick.
Python can be treated in a procedural way, an object-oriented way or a functional way.
Python Installation
Many PCs and Macs will have python already installed.
To check if you have python installed on a Windows PC, search in the start bar for Python or run
the following on the Command Line (cmd.exe):
To check if you have python installed on a Linux or Mac, then on linux open the command line
or on Mac open the Terminal and type:
1
If you still haven’t set-up your IDLE’s, here’s Week-0 assignment.
1. Hello World:
The "Hello, World!" program is a traditional first program in programming languages. It serves
as a simple way to confirm that the programming environment is set up correctly and that the
developer can run and execute code.
Code:
Variables are used to store and manage data in a program. Python supports various data types
such as integers, floats, strings, and booleans, allowing flexibility in representing different kinds
of information.
Code:
3. Conditional Statements:
Conditional statements, such as if-else, allow the program to make decisions based on certain
conditions. This enables the execution of different code blocks depending on whether a
condition is true or false.
Code:
2
4. Conditionals Statements with Mathematical Operators:
Code:
3
Loops are used for repetitive tasks. A FOR loop iterates over a sequence (like a list), while a
WHILE loop continues execution as long as a specified condition is true.
Code:
6. Functions:
Functions are reusable blocks of code that perform a specific task. They help in organizing code
and make it more modular. A function is defined with the ‘def’ keyword.
Code:
Input and output operations allow interaction with the user. The ‘input()’ function takes user
input, and ‘print()’ displays output on the console.
Code:
4
“This was Robotics CodeSpace week-1. You’re off for problem-sets now! Try your best and
remember to join your peers on the discord server. Good-luck!”