MBARARA UNIVERSITY OF SCIENCE AND TECHNOLOGY
COURSE CODE: BIT2105
NAME: MUGABE ARNOLD
REG. NO: 2023/BIT/250/PS
COURSE UNIT: SCRIPTING LANGUAGES(PYTHON)
LECTURER: MR.YONASI SAFARI
ASSIGNMENT: 01
QUESTIONS:
What is python? Describe its key characteristics and popularity
What is a script? How does it differ from a program?
What are the different data types in python? Provide examples for each.
Explain the concept of variables and how they are used in python.
What are operators and their types in python? Give examples of arithmetic,
comparison, and logical operators.
1.python is a high-level, general-purpose programming language with dynamic
semantics.it was created by Guido van Rossum in the late 1980s and named after the
British comedy group Monty Python’s Flying Circus.
Python’s popularity stems from its simplicity, readability, and versatility, making it
suitable for a wide range of applications, including web development, data science,
machine learning and automation.
2. A script is a sequence of instructions written in a programming language that is
intended to be interpreted and executed by a computer.
It differs from a program in that a script is typically designed to perform a specific task
or set of tasks, whereas a program can be more complex and modular, consisting of
multiple scripts or modules working together.
3.The different data types in python include:
Integers: whole numbers, such as 1,2,3,
Floats: Decimal numbers, such as 3.14 and -3.7
Strings: sequences of characters enclosed in quotation marks, such as “hello”
and ‘goodbye’
Boolean; values that can be either True or False
Lists: ordered collections of elements, which can be of any data type, including
other lists.
Tuples: ordered collections of elements that cannot be modified after
Sets: unordered collections of unique elements.
4.In python, a variable is a name given to value that can be stored manipulated in the
computer’s data types, and their values can change during the execution program.
Variables are used to store and retrieve data, perform calculations, and manipulate data
in various ways.
5.operators are symbols or keywords used in python to perform operations on variables
or values. There are three main types of operators in python:
Arithmetic operators: These are used to perform mathematical operations, such
as addition(+),subtraction(-),multiplication(*),division(/),and modulus(%).
Comparison operators: These are used to compare two values or variables such
as equal to (==),not equal to(!=),greater than(>),less than(<),greater than or
equal to(>=),and less than or equal to(<=).
Logical operators: These are used to combine multiple conditions or expressions,
such as and (&&),or (II),and not(!).
6.The python interpreter is a program that translates python code into machine code
that can be executed by the computer’s processor. When you write and run python code,
the interpreter reads the code, performs syntax analysis, compiles it into bytecode. This
process allows you to write and run python programs without the need for explicit
compilation.
7.comments in python are lines of code that are ignored by the interpreter and are used
to provide explanations, notes, or additional information to programmers or other
readers of the code. Comments begin with the “#” symbol and continue until the end of
the line. Comments are useful for documenting code, explaining algorithms or logic, and
making it easier to understand maintain.
8.indentation is a crucial aspects of python syntax, as it is used to define the structure of
code blocks, such as loops, conditional statements, and functions. Indentation helps to
organise code and make it more readable, as well as to indicate the scope of variables ad
control flow. The importance of indentation in python lies in its ability to define the
structure of code blocks without the need for explicit keywords or braces, making it
more concise and easier to read.
9.A Python virtual environment is a self-contained environment where you an install
and use packages and libraries without affecting the global python environment. It
allows you to isolate your project’s avoid conflicts with other projects dependencies are
consistent across different environments, testing, and production.
10.some common python development tools and IDEs include:
PyCharm: A popular, feature rich IDE developed by JetBrains.
Visual studio code: A lightweight, opensource code editor with python support.
Spyder: An open-source scientific computing environment.
Eclipse with the pyDev plugin: An open -source IDE with python support
IDLE:Abasic,built-in IDE that comes with the python standard library