You are on page 1of 5

Robotics Programming CodeSpace ‘24

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

What can Python do?


 Python can be used on a server to create web applications.
 Python can connect to database systems. It can also read and modify files.
 Python can be used to handle big data and perform complex mathematics.
 Python can be used for rapid prototyping, or for production-ready software
development.

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:

2. Variables and Data Types:

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:

Mathematical operators in Python allow you to perform arithmetic operations on numeric


values. These operations include addition, subtraction, multiplication, division, and more.
Combining conditional statements with mathematical operators enhances the ability to create
dynamic decision-making in your code.

Code:

5. Loops - FOR and WHILE:

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:

Here’s a list of Built-in Functions in Python.

For further understanding, use the following links:

- Python Functions – How to Define and Call a Function (freecodecamp.org)


- Python Functions - GeeksforGeeks
- Python Functions- (w3schools.com)

7. Input and Output:

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!”

-Mehkaan Khan, RDS President

You might also like