0% found this document useful (0 votes)
347 views

PRACTICAL 2 python

The document outlines a Python laboratory experiment for Computer Engineering students, focusing on displaying messages and reading user input. It explains the significance of Python's interactive and script modes, provides example code, and details the steps to execute a program in script mode. Additionally, it includes practical questions related to programming modes and execution steps.

Uploaded by

bhavana.gupta
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
347 views

PRACTICAL 2 python

The document outlines a Python laboratory experiment for Computer Engineering students, focusing on displaying messages and reading user input. It explains the significance of Python's interactive and script modes, provides example code, and details the steps to execute a program in script mode. Additionally, it includes practical questions related to programming modes and execution steps.

Uploaded by

bhavana.gupta
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 7

++++++++++

OF COMPUTER ENGINEERING

Subject: - PYTHON Subject Code: 314004


Semester: - 4TH Course : Computer Engineering
Laboratory No: LAB004 Name of Subject Teacher: Poonam Pawar
Name of Student: -Bhavana Gupta Roll Id: - 23203B0055

Experiment No: 2
Title of Experiment
\1. Write python program display welcome message on screen.

2. Implement the python program to read data from user and display data
on screen.

Practical Significance
Python is a high level language which is trending in recent past. To make it more user friendly

developers of Python made sure that it can have two modes Viz. Interactive mode and

Script Mode. The Script mode is also known as normal mode and uses scripted and

finished .py files which are run on interpreter whereas interactive mode supports command

line shells. Students will able to understand how to run program using Interactive and Script

Mode.

Page | 1
Code :
1:

print("Welcome to python programing ")

Output :

2:

a=input("Enter value for a : ")

print("Entered value : "a)

Page | 2
Output :

Conclusion:
this practical highlights two key concepts in Python: displaying messages using the print() function and

reading user input with the input() function. These foundational skills are essential for interactive

programs and building user-friendly applications, enabling communication between the program and

the user effectively.

Practical related questions


1. List different modes of Programming in Python
Page | 3
Python supports various programming modes:

1. Interactive Mode: Execute code line-by-line.


2. Scripting Mode: Write and execute full programs in .py files.
3. Object-Oriented Programming (OOP): Use classes and objects.
4. Functional Programming: Use functions as first-class citizens.
5. Procedural Programming: Focus on procedures or functions.
6. Imperative Programming: Step-by-step commands to change state.
7. Event-Driven Programming: Trigger actions based on events.

2. State the steps involved in executing the program using Script Mode.

Here are the steps involved in executing a Python program using Script Mode:

1. Write the Python Code:

a. Open a text editor (e.g., VS Code, Sublime Text, or even a simple Notepad) and write your
Python code.
b. Save the file with a .py extension (e.g., program.py).

2. Open the Command Line/Terminal:

a. Open the terminal (on macOS/Linux) or Command Prompt (on Windows).

3. Navigate to the Directory:

a. Use the cd (change directory) command to navigate to the folder where your Python
script is saved.

4. Execute the Python Script:

a. Run the Python script by typing python program.py (or python3 program.py
depending on your Python version) and press Enter.

5. View the Output:

a. The output of your Python program will be displayed in the terminal.

6. Close the Terminal (Optional):

a. Once the program finishes execution, you can close the terminal or run another script.

These steps allow you to write, save, and execute a Python program efficiently in Script Mode.

Page | 4
3. Write a Python program to display “MSBTE” using Script Mode.
print("MSBTE")

Page | 5
Grade and Process Related Product Related Dated Sign
Dated
Signature of (35) (15)
Teacher

Page | 6
Page | 7

You might also like