Python Lab Manual (22616) Answers Practical 2

 Python Lab Manual (22616)Answers 


Practical 2: Write A simple python program to display Message On  Screen


* Practical Related Question

1) List Different Modes Of Programming in python 
Ans => 
         1) Interactive Mode :interactive mode is a command line shell. If we write a python program in the command line shell. Typically the interactive mode is used to test the features of the python, or to run a smaller script that may not be reusable.

           2) Script Mode :Script mode is mainly used to develop business applications. In Script mode, we can write a group of python statements in any  editors or IDEs.


2)Describe Procedure to Executive Program Using Interactive Mode

Ans => 1) Open a command prompt in WINDOWS to call a python shell to run the interactive mode. On Linux or macOS open up the terminal and thereafter type “Python” and press enter.

2)This results in the opening of the Python shell in interactive mode.

3)Then we can executive any command 

4)Ex : >>>Print( Hello World)


3)State  the Steps involved in Executing The Program Using Script Mode

Ans => 1) write your code in a text file

          2)save the particular file with a .py’ extension. You can use any available text editor.

         3) Then executive Program 


4) State the procedure to make file executable 

Ans=>

1: Open up a terminal and run pip install pyinstaller

2: Using the terminal, go to the directory where your script is located (use the cd command

3: Once you‘re in the right directory, write a command with the following syntax pyinstaller --onefile name_of_script.py in the terminal to make the script executable.



*Exercise  : 

1)Write Python program to display your name using interactive mode 

Ans=>


2) Write Python program to display "MSBTE" Using Script Mode

Ans=> 1) Create File index.py and paste below code in it

print("MSBTE")


Post a Comment

0 Comments