Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
56 views

Comparison Table Between Programming Language and Scripting Language

SQL

Uploaded by

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

Comparison Table Between Programming Language and Scripting Language

SQL

Uploaded by

Yuv Raj
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 8

Comparison table between Programming

Language and Scripting Language

Programming Language Scripting Language

A programming language is a computer language A scripting language is a type of


that is used to communicate with computers using a programming language designed for a
set of instructions. runtime system to automate the execution of
tasks.

It is compiled language or compiler-based language. It is interpreted language or interpreter-based


language

It is used to develop an application or software from It is used to combine existing components


scratch. and automate a specific task.

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.

These languages are required to be compiled. There is no need for compilation.

It is comparatively difficult to write code in a It is comparatively easy to write code in the


programming language, and it requires numerous scripting language, and it requires few lines of
lines of code for each task. code for each task.

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.

There is the high maintenance cost. There is less maintenance cost.

All programming languages are not scripting All scripting languages are programming
languages languages

It generates a .exe file. It does not create a .exe file.

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:

1. Conditional Statements (if, elif, else):

- `if`: It is used to execute a block of code if a specified condition is True.

- `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:

print("x is greater than 5")

elif x == 5:

print("x is equal to 5")

else:

print("x is less than 5")

```

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

for item in [1, 2, 3, 4, 5]:

print(item)

```

- `while` loop: Repeats a block of code as long as a specified condition is True.

```python

count = 0

while count < 5:

print(count)
count += 1

```

3. Loop Control Statements:

- `break`: Terminates the current loop and exits it prematurely.

```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)

```

4. Exception Handling (try, except, else, finally):

- `try`: Contains the code that might raise an exception.

- `except`: Defines the code to be executed when an exception is raised.

- `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:

print("Division by zero is not allowed.")

else:
print("Result is:", result)

finally:

print("This code always runs.")

```

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:

1. Conditional Statements (if, elif, else):

```python

x = 10

if x > 5:

print("x is greater than 5")

elif x == 5:

print("x is equal to 5")

else:

print("x is less than 5")

```

Output:

```

x is greater than 5

```

2. For Loop:

```python

for item in [1, 2, 3, 4, 5]:

print(item)

```

Output:

```
1

```

3. While Loop:

```python

count = 0

while count < 5:

print(count)

count += 1

```

Output:

```

```

4. Loop Control Statements (break and continue):

```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:

```

```

5. Exception Handling (try, except, else, finally):

```python

try:

result = 10 / 0

except ZeroDivisionError:

print("Division by zero is not allowed.")

else:

print("Result is:", result)

finally:

print("This code always runs.")

```
Output:

```

Division by zero is not allowed.

This code always runs.

```

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.

Processing Texts in Natural Languages with Python:

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:

- Lowercasing: Converting all text to lowercase to ensure uniformity.

- Tokenization: Splitting text into words or sentences for analysis.

- Removing special characters: Eliminating non-alphanumeric characters and punctuation.


- Stop word removal: Filtering out common words (e.g., "the," "and") that don't carry significant meaning.

- Stemming or Lemmatization: Reducing words to their root forms to avoid redundancy.

- 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.

You might also like