ICT1011 - Lab - Manual - 3 Answer
ICT1011 - Lab - Manual - 3 Answer
ICT1011 - Lab - Manual - 3 Answer
A.C. 2023-2024
ICT-1011: Introduction to Programming and Problem Solving
Example:
if x>5:
print(“Hello Human”)
Example:
if x>5:
print(“Hello Human”)
else:
print(“How are you”)
PRACTICE:
1. Write a program that will read two numbers. Determine and output the larger number.
if num1>num2:
print("The larger number is ", num1)
if num2>num1:
print("The larger number is ", num2)
if num1>num2:
large=num1
else:
large=num2
LABORATORY EXERCISES:
Task 1
Write a Python program using if statements that will display a menu of a 5-function calculator
as follows:
Prompt the user to enter two integer numbers and choose a function from the menu to
perform. Calculate and display the result.
```python
```
```python
while True:
print("Menu:")
print("+ to add two numbers")
print("- to subtract two numbers")
print("* to multiply two numbers")
print("/ to divide two numbers")
print("** to find the exponent of two numbers")
print("q to quit")
if user_choice == 'q':
break
if user_choice == '+':
result = num1 + num2
print("Result:", result)
elif user_choice == '-':
result = num1 - num2
print("Result:", result)
```python
```
```python
```
Task 2
A food shop will give discount of 15% if the cost of purchased quantity is equal to or more than
1500 AED. No discount will be given for purchases less than 1500 AED.
Write a Python program using if-else statement that will ask the user for the quantity and the
unit price of the food item. Calculate and display the original cost, the discounted amount, and
the cost after discount (if no discount, then the discount field should show zero).