Diplomatech Academy -
Manual Solutions and outputs
Python Programming Course Code: 314004
y
Practical No. 2: Write simple Python program to display
m
message on screen
de
IX. Conclusion
ca
Ans.
A
We have successfully implemented a simple Python program to display a message
h
on the screen. This practical demonstrates how the print() function works in
Python. It is one of the fundamental commands to output data to the console.
ec
Understanding this basic concept is essential for building more complex programs.
aT
XII Practical Related Questions Note: Below given are few sample questions
m
for reference. Teachers must design more such questions to ensure the
achievement of identified CO.
lo
ip
Practical related questions (Teacher may assign more questions related to
D
practical. Students may add extra pages for answer if needed)
1. List different modes of Programming in Python
Ans.
Python supports several modes of programming to cater to various use cases.
These include:
1. Interactive Mode:
○ Code is written and executed directly in the Python interpreter or
REPL (Read-Eval-Print Loop).
○ Ideal for quick tests and debugging.
y
Example:
m
python
CopyEdit
de
>>> print("Hello, Python!")
Hello, Python!
ca
○
2. Script Mode: A
○ Python code is written in a script file (e.g., .py) and executed as a
h
whole.
ec
○ Suitable for developing complete programs or applications.
○ Example: A Python file (script.py) containing:
aT
python
CopyEdit
print("This is script mode!")
m
lo
ip
2. State the steps involved in executing the program using Script Mode.
D
Ans.
Here are the steps involved in executing a Python program using Script Mode:
1. Write the Program:
○ Open a text editor or an Integrated Development Environment (IDE)
like VS Code, PyCharm, or IDLE.
○ Write your Python code in a file and save it with a .py extension.
Example:
print("Hello, Script Mode!")
○ Save the file as example.py.
y
2. Open the Terminal or Command Prompt:
m
○ Navigate to the directory where the Python script file is saved.
de
○ Use the cd command to change the directory if needed.
3. Run the Python Script:
ca
Type the following command and press Enter:
python example.py
A
h
○ (Use python3 instead of python if your system requires it.)
ec
4. View the Output:
aT
○ The script is executed, and the output will be displayed on the
terminal or command prompt.
m
Example Output:
lo
Hello, Script Mode!
ip
D
3. Write a Python program to display “MSBTE” using Script Mode.
Ans.# Program to display "MSBTE"
print("MSBTE")
D
ip
lo
m
aT
ec
h
A
ca
de
m
y
display information such as physical addresses, phone numbers, emails, or social
media handles. Text inside the <address> tag is often displayed in italic style by
default to differentiate it from regular content.
y
m
de
Created By Mohade Sir and DiplomTech Academy Team
ca
Contact
8261884261
#diplomatechacademy
#indemandsoftwaredevelopers
A
h
ec
aT
m
lo
ip
D