You are on page 1of 5

UNIVERSITY OF BAHRAIN

College of Information Technology


Department of Computer Engineering

ITCE300

Lab experiment no. 1

Introduction to Python

Submitted by:Nurulain zulfiqar ahmed

ID: 20176204
Introduction:

In this lab we are going to study about Python. It’s a high level programming language and one of the
best programming language for computer and network engineers. It has a large committee and a large
set of libraries and packages.

Discussion:

1. What is the name of python packet manager? How to list outdated packages installed in the
system?
Name of python packet manager is PIP. It’s a standard package management system which is
used to install and manage software packages written in python.
To list outdated packages installed in system we use:
$ pip list --outdated

2. What are the prefixes for binary, octal and hexadecimals numbers?
Prefixes for
Binary number: 0b
Octal number: 0o
Hexadecimal number: 0x

3. How to reverse a string?


Three methods can be used to reverse a string :
1. Slicing: create a slice that starts with the length of string and ends at index 0
To reverse a string using slicing:
stringname[stringlength: :-1]
without specifying the length of string:
stringname[: : -1]
2. Loop:
3. Use join: it reverses a string using reverse iteration with the reversed() built in function.

4. What are the files method used to check whether the file stream supports random access
and can be written to?

Methods which can used to check whether the file stream supports random access and can
be written to are:
 seekable()
 writable()

5. Write a single python script that do two types of calculations for


numbers fed by the user (call your program <your_st_id>-
L1_calculator.py)
a. Calculates the output power of a link for given gain and input
power. Provide a snapshot of your program’s output if the input
power is 1 W and the gain is -15 dB.
b. Calculates the link capacity using Nyquist formula. There will be
two given variables, B for bandwidth, and M represents number of
signal levels.

Conclusion:
In this lab we learnt briefly about python, what it is ,how we can use to create
programs and we also got to know about its different methods.

You might also like