0% found this document useful (0 votes)
11 views3 pages

Practical 3

The document outlines a practical session for students at Malawi University of Science and Technology, focusing on basic programming tasks in Python. It includes tasks on string concatenation, string replication, type casting, and arithmetic operations. Each task provides specific instructions for students to follow in order to practice their coding skills.

Uploaded by

danieldenis6060
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)
11 views3 pages

Practical 3

The document outlines a practical session for students at Malawi University of Science and Technology, focusing on basic programming tasks in Python. It includes tasks on string concatenation, string replication, type casting, and arithmetic operations. Each task provides specific instructions for students to follow in order to practice their coding skills.

Uploaded by

danieldenis6060
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/ 3

MALAWI UNIVERSITY OF SCIENCE AND TECHNOLOGY

DEPARTMENT: CSIT

PRESENTED TO: IMV, DGI, PG, MEC, ESC, MT, LCC, DR, WQM, MB, SS, TXE, MNE, SS,
MMB, GIS, SES

Practical session 2
Task 1: string concatenation

• Create a variable and assign it the first name using the input function
• Create another variable and assign last name using the input function
• Concatenate the 2 variables and store the result in a new variable called fullname

• Use the variable fullname to display the full name on the screen and produce a reasonable
output (leave spaces between the first name and the last name)

Task 2: string replication

• Create a variable and give it a value I love python


• Print the value 5 times in the variable by using the string replication operator

Task 3: type casting

• Using your knowledge on type casting


• Write a program that asks a user to give their age and store this value in
a variable called age
• Add 2 to the given age and store the result in another variable called
age2

• Print the result on the screen using the variable age2 by saying your age is

Task 4:
Gracious has a value of 3 and he wants to share this value to Martha who apparently understands
numbers with decimal points only. As a solution to this, use your knowledge of type casting to
create a variable named x that will hold the floating point number from the integer 3 and print this
value on the screen.
Task 5:

 Write the following expression on your respective IDLE platforms:


5 ** 6 / 10 * 7

 Take note of the result after running the program


 Use parenthesis to change the order of evaluation to start with 10 * 7
 Compare this value to the previous one

Thanks for completing the practical session…

You might also like