Swe-102 Lab 01!
Swe-102 Lab 01!
Swe-102 Lab 01!
LAB # 01
INTRODUCTION
OBJECTIVE
To become familiar with the Python Programming by using an Integrated Development
Environment
THEORY
Programming
The act of writing computer programs is called computer programming. A computer
program is a sequence of instructions written using a computer programming language
to perform specified tasks by the computer. There are a large number of programming
languages that can be used to write computer programs, for example: Python, C, C++,
Java, PHP, Perl, Ruby etc.
Using an IDE will save a lot of time and effort in writing a program. However, one
should be careful of some of the pitfalls of using an IDE as it may not be ideal for
everyone and might not be suitable in every situation. Some IDEs are very complicated
to use and may consume a lot of resources.
1
Programming Fundamentals (SWE-102) SSUET/QR/114
Many IDEs support Python Programming Language. Some of the popular IDEs are
listed below.
Standalone IDEs:
Microsoft Visual Studio Code
https://code.visualstudio.com/
Eclipse
https://www.eclipse.org/downloads
NetBeans
https://netbeans.org/downloads/
Thonny
https://thonny.org/
Anaconda
https://www.anaconda.com/distribution/
Online IDEs:
Ideone
https://ideone.com/
Online GDB
https://www.onlinegdb.com/online_python_debugger
Step#1: Go to https://thonny.org
Step#2: Download the version for Windows and wait a few seconds while it
downloads.
2
Programming Fundamentals (SWE-102) SSUET/QR/114
Step#3: Run the .exe file.
3
Programming Fundamentals (SWE-102) SSUET/QR/114
Step#4: Follow the installation wizard to complete the installation process and just
click "Next".
4
Programming Fundamentals (SWE-102) SSUET/QR/114
print("Hello, World! \n Python is fun") instructs the computer to print on the screen the
string of characters enclosed by the quotation marks.
\n is an escape sequence that means newline. It causes the cursor to position to the
beginning of the next line on the screen.
pound sign (#) is a comment on a line, called a line comment, or enclosed between
three consecutive single quotation marks (''') on one or several lines, called a paragraph
comment.
Python programs are case sensitive. It would be wrong, for example, to replace print in
the program with Print. Several special characters can be seen (#, ", ()) in the program.
They are used in almost every program. Table 1.1 summarizes their uses.
5
Programming Fundamentals (SWE-102) SSUET/QR/114
6
Programming Fundamentals (SWE-102) SSUET/QR/114
EXERCISE
A. Create a file named lab1.py. Write the following code in the file. Execute it and
show the output. (You can use the Snipping Tool to take a snapshot of your output
window).
1. Code:
# My first program
print("\nWelcome in the world of programming!")
Output:
2. Code:
7
Programming Fundamentals (SWE-102) SSUET/QR/114
Output:
B. Write a program in Python language that prints your bio-data on the screen.
Show your program and its output (Name, roll number, department, Section,
City)