Comparison Table Between Programming Language and Scripting Language
Comparison Table Between Programming Language and Scripting Language
It runs or executes independently and does not It runs or executes inside another program.
depend on the parent (exterior) program.
It uses a compiler to convert source code into It uses an interpreter to convert source code
machine code. into machine code.
As it uses a compiler, hence the complete program As it uses an interpreter, hence the program is
is converted into machine code in one shot. converted into machine code line by line.
The development time in programming languages is The development time in a scripting language
high as more lines are required. as a smaller number of lines are required.
All programming languages are not scripting All scripting languages are programming
languages languages
Usually, programming languages do not support or Scripting languages provide great support to
provide very little support for user interface user interface design, data types, and graphic
designing, data types, and graphic designing. design.
Some popular examples are C, C++, Java, Scala, Some popular examples are Perl, Python,
COBOL, etc. JavaScript, etc.
Control flow statements in Python are used to determine the order in which statements are executed in a Python
program. They allow you to make decisions, repeat tasks, and create structured logic within your code. The primary
control flow statements in Python include:
- `elif` (short for "else if"): Used to test multiple conditions after an initial `if` statement.
- `else`: Specifies a block of code to be executed if the condition(s) in the `if` and `elif` clauses are False.
```python
x = 10
if x > 5:
elif x == 5:
else:
```
2. Loops:
- `for` loop: Iterates over a sequence (e.g., a list, tuple, string, or range) and executes a block of code for each
element in the sequence.
```python
print(item)
```
```python
count = 0
print(count)
count += 1
```
```python
for i in range(10):
if i == 5:
break
print(i)
```
- `continue`: Skips the current iteration of a loop and proceeds to the next iteration.
```python
for i in range(5):
if i == 2:
continue
print(i)
```
- `else`: Contains code that is executed if no exceptions are raised in the `try` block.
- `finally`: Contains code that is always executed, whether or not an exception occurred.
```python
try:
result = 10 / 0
except ZeroDivisionError:
else:
print("Result is:", result)
finally:
```
These control flow statements allow you to create structured and dynamic programs by controlling the flow of
execution in your Python code.
Certainly, here is the expected output for the code examples I provided in Python:
```python
x = 10
if x > 5:
elif x == 5:
else:
```
Output:
```
x is greater than 5
```
2. For Loop:
```python
print(item)
```
Output:
```
1
```
3. While Loop:
```python
count = 0
print(count)
count += 1
```
Output:
```
```
```python
for i in range(10):
if i == 5:
break
print(i)
```
Output:
```
0
```
```python
for i in range(5):
if i == 2:
continue
print(i)
```
Output:
```
```
```python
try:
result = 10 / 0
except ZeroDivisionError:
else:
finally:
```
Output:
```
```
In the exception handling example, an exception (ZeroDivisionError) is raised when dividing by zero, so the code in
the `except` block is executed. The code in the `else` block is skipped, and the code in the `finally` block is executed,
which always runs regardless of whether an exception occurred.
1. *NLTK Corpora*:
- NLTK (Natural Language Toolkit) is a Python library for working with human language data. NLTK includes various
corpora, which are large collections of text used for linguistic research and analysis.
- You can access NLTK corpora to perform tasks like text analysis, sentiment analysis, and text classification. For
example, you can use the Gutenberg Corpus for literary texts or the Twitter Samples Corpus for social media text.
- To use an NLTK corpus, you'll typically import NLTK, download the desired corpus using nltk.download(), and then
access the text data and perform various text processing tasks.
2. **Surprise!**:
- "Surprise" refers to the Surprise library in Python, which is primarily used for building and analyzing
recommendation systems. It provides a collection of collaborative filtering algorithms for recommendation tasks.
- Surprise makes it easy to load and process user-item interaction data and apply algorithms to generate
personalized recommendations.
- You can use Surprise to build recommendation engines that predict user preferences for products, movies, music,
or any other items.
3. *Normalization*:
- Text normalization is the process of standardizing and cleaning text data to make it consistent and suitable for
analysis. It involves various techniques, such as:
- Text normalization is a crucial step in natural language processing tasks like text classification, sentiment analysis,
and information retrieval.
These techniques and libraries are essential for working with text data in natural languages, enabling tasks like text
analysis, recommendation systems, and data cleaning for text-based applications in Python.