0% found this document useful (0 votes)
8 views

Subj DynamicLanguage

Dynamic programming languages execute behaviors at runtime that static languages perform at compile-time, allowing for modifications such as changing variable types or adding properties. Python features built-in data types like numbers, strings, lists, and dictionaries, and utilizes libraries such as Pandas and NumPy for data analysis. Key distinctions between lists and tuples include mutability, syntax, and memory usage, while a Series in Pandas is one-dimensional and a DataFrame is two-dimensional, supporting multiple data types.

Uploaded by

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

Subj DynamicLanguage

Dynamic programming languages execute behaviors at runtime that static languages perform at compile-time, allowing for modifications such as changing variable types or adding properties. Python features built-in data types like numbers, strings, lists, and dictionaries, and utilizes libraries such as Pandas and NumPy for data analysis. Key distinctions between lists and tuples include mutability, syntax, and memory usage, while a Series in Pandas is one-dimensional and a DataFrame is two-dimensional, supporting multiple data types.

Uploaded by

salmaabo341
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

1.

Explain the Dynamic programming language

Dynamic programming language, in computer science, is a class of high-level programming


languages which, at runtime, execute many common programming behaviors that static
programming languages perform during compilation.

These behaviors could include extension of the program, by adding new code, by extending objects
and definitions, or by modifying the type system.

A dynamic programming language is a programming language in which operations otherwise done


at compile-time can be done at run-time. For example, in JavaScript it is possible to change the
type of a variable or add new properties or methods to an object while the program is running.

This is opposed to so-called static programming languages, in which such changes are normally
not possible

❑ Dynamic and Non-Dynamic Examples

❑ Numerous languages fall into the dynamic category, including JavaScript, VBScript, Lisp,
Perl, PHP, Python, Ruby and Smalltalk. Examples of languages that are not dynamic are
C/C++, Java, COBOL and FORTRAN.

2. What built-in data types are used in Python?

Python uses several built-in data types, including:

Number (int, float and complex)

String (str)

Tuple (tuple)

Range (range)

List (list)

Set (set)

Dictionary (dict)

3. What are some of the most common libraries?

The most widely used Python data analysis libraries include:


Pandas

NumPy

SciPy

TensorFlow

SciKit

Seaborn

Matplotlib

4. What is the difference between lists and tuples in Python?

Lists and tuples are classes in Python that store one or more objects or values. Key differences
include:

Syntax – Lists are enclosed in square brackets and tuples are enclosed in parentheses.

Mutable vs. Immutable – Lists are mutable, which means they can be modified after being created.
Tuples are immutable, which means they cannot be modified.

Operations – Lists have more functionalities available than tuples, including insert and pop
operations, as well as sorting.

Size – Because tuples are immutable, they require less memory and are subsequently faster.

5. What is the difference between a series and a dataframe in Pandas?

Series only support a single list with index, whereas a dataframe supports one or more series. In
other words:

Series is a one-dimensional array that supports any datatype (including integers, strings, floats,
etc.). In a series, the axis labels are the index.

A dataframe is a two-dimensional data structure with columns that can support different data
types. It is similar to a SQL table or a dictionary of series objects.
6. What is __init__() in Python?

The __init__() method is known as a constructor in object-oriented programming (OOP) terminology.


It is used to initialize an object's state when it is created. This method is automatically called when
a new instance of a class is instantiated.

Purpose:

Assign values to object properties.

Perform any initialization operations.

Example:

We have created a book_shop class and added the constructor and book() function. The
constructor will store the book title name and the book() function will print the book name.

To test our code we have initialized the b object with “Sandman” and executed the book() function.

class book_shop:

# constructor

def __init__(self, title):

self.title = title

# Sample method

def book(self):

print('The tile of the book is', self.title)

b = book_shop('Sandman')
b.book()

# The tile of the book is Sandman

You might also like