If you come across any unexpected problems, check the VibrantNotes Status for help. Check

Getting Started with Python

Getting started with python - short notes for class 11 computer pw
Getting started with python notes

Introduction

  • Python was named after famous BBC comedy show namely.
  • Python language was developed by Guido Van Rossum in February 1991.
  • Python is influenced with ABC language and Modula-3 .

Key features of Python:

  1. Interpreted language
  2. Dynamically typed
  3. Object-oriented
  4. Automatic memory management
  5. Extensive libraries
  6. Cross-platform
  7. Clear syntax
  8. Beginner friendly
  9. Scripting capable
  10. Batteries included
  11. Open source
  12. Large standard library
  13. Extensible
  14. Modules
  15. Classes
  16. Inheritance
  17. Polymorphism
  18. Encapsulation
  19. Functions
  20. Exception handling
  21. File I/O
  22. Multithreading
  23. Database connectivity
  24. GUI programming
  25. Scripting/automation
  26. Web development
  27. Data analysis
  28. numeric computing
  29. Extensibility
  30. Readability
  31. Large community
  32. Cloud computing
  33. Machine learning libraries
  34. Artificial intelligence
  35. Desktop applications
  36. Game development

How to install Python on Computer:

Here are the steps to install Python on your computer:

Step 1: Visit the official Python website

Go to the official Python website Python.org. This website provides the latest version of Python and additional resources.

Step 2: Choose the Python version

On the Python website, you will find multiple versions available for download. Choose the version that best suits your needs. For beginners, it is recommended to download the latest stable version.

Step 3: Download Python installer

Once you've selected the Python version, click on the download link to start the download process. Choose the installer appropriate for your operating system (Windows, macOS, or Linux).

Step 4: Run the installer

After the download is complete, locate the downloaded installer file and run it. The installer will guide you through the installation process.

Step 5: Customize the installation (optional)

During the installation process, you may be presented with some customization options. You can choose to customize the installation location, add Python to the system path, or install additional features. If you're unsure, it's usually safe to go with the default settings.

Step 6: Start the installation

Once you've customized the installation (if desired), proceed with the installation process by clicking "Install" or a similar button. The installer will copy the necessary files and set up Python on your computer.

Step 7: Verify the installation

After the installation is complete, you can verify if Python is installed correctly. Open a command prompt (Terminal on macOS/Linux) and type "python" or "python3" (depending on your system) followed by the Enter key. If Python is installed properly, you will see the Python version and a ">>>" prompt.

Congratulations! You have successfully installed Python on your computer. You can now start writing and executing Python code.

What is Interactive mode in Python?

Interactive mode in Python allows you to directly interact with the Python interpreter by typing and executing code statements one at a time. 
It is useful for experimenting, learning, debugging, quick calculations, and prototyping. 
You can access it by opening a command prompt and typing "python" or "python3". 
It provides a prompt (">>>" or "...") where you can enter Python code, see the results immediately, and continue entering more statements or exit when done.

What is Script mode in Python?

Script mode in Python refers to writing and executing Python code from a script file. Instead of entering code interactively line by line, you can write a sequence of Python statements in a text file with a .py extension. This file is commonly referred to as a Python script.

Examples illustrating both interactive mode and script mode in Python:

Interactive Mode (Python Shell) Example:

  1. Open a command prompt (Terminal on macOS/Linux) and type "python" or "python3" to enter interactive mode.
  2. Enter the following Python statements one by one, pressing Enter after each line:
Interactive Mode
 
>>> name = "John"
>>> age = 25
>>> print("My name is", name)
>>> print("I am", age, "years old")
    
Output
My name is John
I am 25 years old
      

Script Mode Example: 

  1. Open a text editor and create a new file called "hello.py".
  2. In the "hello.py" file, write the following Python code:
Script Mode
name = "John"
age = 25
print("My name is", name)
print("I am", age, "years old")
      
Output
My name is John
I am 25 years old
      
In interactive mode, you interactively enter and execute code statements one at a time, while in script mode, you write a sequence of code in a file and execute the entire script using the Python interpreter. Both modes have their uses depending on the specific requirements of your programming tasks.

Multiple Choice Questions 

Q.1 Python is an ____ language.
a) High level 
b) Object oriented
c) Procedural
d) Difficult

Answer : Option (a) High Level

Explanation: Python is considered a high-level programming language. High-level languages are designed to be easily understandable by humans and are more abstracted from the underlying hardware and machine-level operations. Python's syntax is clear and readable, making it user-friendly and efficient for programming tasks.

Q.2 Python uses an ____ to convert source code to object code.
a) Interpreter
b) compiler
c) combination of interpreter and compiler
d) Special virtual engine

Answer : Option (a) Interpreter

Explanation: Python uses an interpreter to convert its source code into object code. The interpreter processes the code line by line, executing it directly without the need for a separate compilation step. This allows for rapid development and easy debugging since changes in the code can be tested immediately without the need for recompilation.

Q.3 Python code can run on a variety of platforms, it means Python is a ____ language.
a) graphical
b) cross-platform
c) independent
d)  All of the above

Answer : Option (b) cross-platform

Explanation: Python is considered a cross-platform programming language because it can run on various operating systems and platforms without requiring significant modifications. This makes it versatile and allows developers to write code that can be executed on different systems without major changes.

Q.4 Python programs are typed in 
a) Interactive mode
b) Script mode
c) A combination of script and interactive mode
d) All of these

Answer : Option (d) All of these

Explanation: Python programs can be typed and executed in various modes.
Interactive mode: In this mode, you can enter Python code directly into the interpreter prompt and see the results immediately. It's useful for quick testing and experimentation.
Script mode: In this mode, you write your Python code in a script file (usually with a `.py` extension) and then execute the script using the interpreter. This is the most common way of writing and running Python programs.
Combination of script and interactive mode: You can also use both interactive and script modes together. You might develop parts of your code in the interactive mode and then save it to a script file for more extensive and reusable programming.

 

Q.5 The ____ mode of Python gives instant results of typed statements.

a) Interactive mode
b) script mode
c) Combination of interactive and script mode
d) all of the above

Answer: Option (a) Interactive mode

Explanation: In the interactive mode of Python, you can type statements or commands directly into the interpreter prompt, and it provides instant results for each statement. This mode is useful for testing out code snippets, exploring the behavior of functions, and getting immediate feedback.

Q.6 Which of the following in not a Python IDE?
a) IDLE
b) Spyder
c) Jupyter Notes
d) Sublime Text

Answer: Option (d) Sublime Text

Explanation: Sublime Text is a popular text editor, but it is not specifically categorized as a Python IDE (Integrated Development Environment). While Sublime Text does have features that can aid in Python development, it lacks some of the specialized features and integrations that are typically found in dedicated Python IDEs like IDLE, Spyder, and Jupyter Notebooks.

Q.7 To print the value of a variable, Python uses
a) Print Function
b) print statement
c) print() function
d) Print Statement

Answer : Option (c) print() function

Explanation: To print the value of a variable or any other output in Python, you use the `print()` function. This function takes the value you want to display as its argument and outputs it to the console. The correct syntax is `print(variable_name)` or `print("Text to be printed")`.

Q.8 You do not have to pay for Python and you can view its source code too, it means Python is a 
a) Freeware 
b) open source 
c) Shareware 
d) Free and open source

Answer : Option (d) open source

Explanation: Python is an open-source programming language, which means that its source code is available for anyone to view, modify, and distribute. Additionally, it is free to use, meaning there are no licensing fees associated with its usage. This open-source nature encourages collaboration, innovation, and widespread adoption of the language.


Fill In The Blanks 

Q.1. Python is a ____ level language.
Answer : High Level
Explanation: Python is a programming language that abstracts many low-level details, making it easier for programmers to write code without worrying about memory management and other technical complexities.

Q.2. Python's two working modes are: ____ mode and ____ modes.
Answer : Interactive, Script - respectively.
Explanation: Interactive mode allows you to enter Python commands line by line and immediately see the results. Script mode involves writing code in a script file and executing the entire script.

Q.3. The shortcut key to run a Python program from script mode is ____ .
Answer : F5
Explanation: In many integrated development environments (IDEs), pressing the F5 key is a common shortcut to execute the currently opened Python script.
Q.4. Python programs/ Script are stored in files with ____ extensions.
Answer : .py
Explanation: Python code is typically saved in files with the ".py" extension. For example, "my_program.py" would be a valid Python script file.
Q.5. Python's default distribution's IDE is called ____ .
Answer : IDLE
Explanation: IDLE is a simple integrated development environment that comes bundled with the standard distribution of Python. It provides basic features for writing, running, and debugging Python code.

 

True and False (Booleans)

Q.1 Python is the fastest language. 
Answer : (False)
Explanation: Python is generally slower compared to languages like C or C++. Its focus on readability and ease of use comes at the cost of execution speed.

Q.2 Python code is compiled before running. 
Answer : (False)
Explanation: Python is an interpreted language, which means that the code is executed line by line by the Python interpreter, without a separate compilation step.

Q.3 You can create programs in Python's interactive mode. 
Answer : (True)
Explanation: Yes, you can write and execute individual Python statements or code blocks in the interactive mode, making it useful for quick experimentation and testing.

Q.4 You can create programs in Python's script mode. 
Answer : (True)
Explanation: Absolutely. Python scripts are created by writing code in a plain text file with a .py extension. These scripts can be executed from the command line or an integrated development environment.

Q.5 Python is an interpreted language. 
Answer : (True)
Explanation: Yes, Python is an interpreted language. This means that the Python interpreter reads and executes the code directly, without the need for a separate compilation step.

Students Also Like : 🔗Short Answer Question/Conceptual Questions 

Getting Info...

About the Author

Hi! I'm your Computer Science overseer.

Post a Comment

We value your input but ask that you refrain from spreading hate or disclosing sensitive data. Your comment will be carefully reviewed by our admin team before it appears.
Cookie Consent
We serve cookies on this site to analyze traffic, remember your preferences, and optimize your experience.
AdBlock Detected!
We have detected that you are using adblocking plugin in your browser.
The revenue we earn by the advertisements is used to manage this website, we request you to whitelist our website in your adblocking plugin.
Site is Blocked
Sorry! This site is not available in your country.