Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
4 views2 pages

LAB 3 Update

Uploaded by

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

LAB 3 Update

Uploaded by

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

Python Programming Lab 3

LAB 3: GETTING STARTED WITH PYTHON


Part A: Learn how to use print and input in Python
1. Print “Hello”
2. Write a program to get an input word from a user. Then, display the given word together
with the sentence of “Welcome, ” as below:

3. Write a program to get two inputs from user. Then display the input.
Output sample:

Part B: Test Yourself


Instructions:
• You are to code the following programs in the lab and show the output to your
lecturer.
• Write comment to make your programs readable.
• Use descriptive variables in your program (Name of the variables should show
their purposes)
1. Accept number from user and display it.
2. Accept 2 numbers from user and display addition of it.
3. Accept 2 input values from user and do arithmetic operation. (+, -, *, /, %).
4. A program that will prompt user to input three characters, receive those three characters,
and display a welcoming message to the screen such as ‘Hello xxx! We hope you have a
nice day’.
5. A Program that will assign values to three variables and print them. The first variable
should contain the string ‘Python’, the second should contain the integer 10, and the third
should contain the floating-point value 98.10.
6. A program that will swap two integer variables.
7. Accept 5 subject marks from student and calculate the total and percentage(average) of a
student for a semester and display it.
8. Accept Basic from an employee and calculate salary of an employee by considering
following things. (Grade_pay is double of Basic. DA is 70% of Basic. TA is RM 200.
HRA is 20% of Basic.) Formula for salary = Grade_pay + DA + TA +
HRA.
Python Programming Lab 3

You might also like