0% found this document useful (0 votes)
2 views8 pages

CSE110 Lab Assignment 1 - Data Types, Variables, and I - O

The document outlines the first assignment for the Programming Language I course (CSE110), detailing the tasks students must complete using Python. Students are instructed to ensure they have the necessary lab login credentials and a suitable Python environment set up before starting. The assignment consists of 11 tasks, ranging from basic print statements to more complex calculations involving user input.

Uploaded by

md.shihab.sharar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views8 pages

CSE110 Lab Assignment 1 - Data Types, Variables, and I - O

The document outlines the first assignment for the Programming Language I course (CSE110), detailing the tasks students must complete using Python. Students are instructed to ensure they have the necessary lab login credentials and a suitable Python environment set up before starting. The assignment consists of 11 tasks, ranging from basic print statements to more complex calculations involving user input.

Uploaded by

md.shihab.sharar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

Course Title: Programming Language I

Course Code: CSE110


Assignment No.: 1
Attention
Students must ensure that they have collected the lab login credentials (it is not the G-suite
account) before attending the lab to access the lab computers. The login information was sent
to students' USIS-registered email addresses. If not found, students should request login
information by emailing [email protected] or visiting University Building # 2, Level 18.

Before getting started…


Since all the lab tasks require students to write codes in Python to solve the problems, students
must ensure that a proper Python environment and IDE (e.g. Jupyter Notebook) are set up or
have a stable internet connection to use Google Colaboratory - an online Notebook-style IDE for
writing Python codes.

Jupyter Notebook:
Tutorial: buX | https://www.youtube.com/watch?v=_GQd1jwH0A4

Download Link: https://www.anaconda.com/products/distribution

Google Colaboratory:
Link: https://colab.research.google.com/
Task 1
Write a Python program that prints "hello world" in a console.

Sample Input Sample Output

hello world

Task 2
Write a Python program that prints the summation of 54 and 56. The program must use Python
operators and numbers but not use any variables.

Sample Input Sample Output

110

Task 3
Write a Python program that assigns the values "Fall" and 2022 to variables `season` and `year`
respectively. Then, print the values of both variables in separate lines.

Sample Input Sample Output

Fall
2022

Task 4
Write a Python program that reads the user's name and prints it back as shown in the example
below.

Sample Input Sample Output

John Your name is John

Albert Your name is Albert


Task 5
Write a Python program that reads two integers M and N respectively and finds the value of
𝑁
M^N (or 𝑀 ) and prints the value as shown in the example.

Sample Input Sample Output

2 2^3: 8
3

10 10^3: 1000
3

Task 6
A sailor has a boat known as Téssares Boat, which has four corners. The boat is capable of
carrying goods of any weight as long as there is equal distribution of loads on each corner of the
boat - the center area has been occupied by the engine. The sailor needs your help to know the
maximum amount of weight he can carry in each shipment.

Write a Python program that reads the total weight of the shipment and prints the maximum load
(or weight) the boat can take from the given shipment. We can assume that the weight of each
good is exactly 1 unit, therefore, the weight of 5 units means there are 5 (loose) items in the
shipment.

Sample Input Sample Output

9 8

11 8

23 20
Task 7
Write a Python program that reads 3 integers A, B, and C respectively, and then reads a floating
point number D. After reading, the program should print the result (as int) using the given
formula below.

𝐶 𝐷
Formula110: 𝐴 +𝐵*𝐴− 3

Sample Input Sample Output

2 267
6
8
1.3

9 907
100
1
3.7

88 2022
22
1
3.3
Task 8
Write a python program that takes an integer from the user which represents the number of
chocolates that he/she has. He/She decided to distribute the chocolates equally among 3 friends,
keeping the remaining chocolates for him/herself. Find out the number of chocolates each friend
will receive and the number of chocolates that will be remaining.

Sample Input 1:

50

Sample Output 1:

Each friend will receive 16 chocolates

The number of remaining chocolates is 2

Sample Input 2:

90

Sample Output 2:

Each friend will receive 30 chocolates

The number of remaining chocolates is 0


Optional (9 - 11) [Ungraded]
These tasks are just for practice. No marks will be deducted for not
completing them and no bonus marks will be given for solving them.
Just try and practice these problems

Task 9
Write a Python program that reads two values M and N from the user respectively and prints the
result by joining (concatenating) them in a bottom-up approach as shown in the following
example.

Sample Input Sample Output

5 25
2

Hello WorldHello
World

Python 3Python
3

Task 10
Write a Python program that reads a line from the user and prints the first character of the given
input.

Sample Input Sample Output

The quick brown fox jumps over the lazy dog T

Python is an interpreted language P


Task 11
Write a Python program that reads an integer and prints "True" if the number is even, otherwise,
"False".

Sample Input Sample Output

7 False

0 True

-11 False

-26 True

Next lab
Branching

You might also like