Application Exercise 03 - Update
Application Exercise 03 - Update
Write, save, and run a Python program, that will do the following when run: YOU MAY
CREATE INDIVIDUAL PROGRAMS FOR EACH OF THE FOLLOWING TASKS.
- Make sure to name the files: app3-part1.py and app3-part2. Submitting in other
formats will be penalized or not marked.
- Make sure to follow the proper naming convention inside your program when
naming variables.
- COPYING from others will be heavily penalized and REPORTED to the Dean of
the School.
PART I (5 marks)
count = 0
sum=0
while count<5:
num1 = float(input("Enter number : "))
ref=99999
ref1_f = 0.99
n = float(format(num1, '1.0f'))
print(n)
y=num1-n
z=float(format(y,'0.2f'))
print(z)
if 0<n<1000000:
if 0.0<z<0.99:
sum = num1+sum
print("number is accepted")
count = count + 1
else:
print("enter the number again")
count = count
else:
print("enter the number again")
count = count
print(sum)
PART II (5 marks)
def greet(company_name,position,salary):
print(company_name)
print(position)
print(salary)
company_name="Dominos"
position="Manager"
salary="25000"
greet(company_name,position,salary)
Answer
import math
def pow_num(a):#function for multiplication
power=(a*a);
return power; #return value
def mod_num(y):
num1=int(input("input the number one: "))#input from
user for num1
modulus=pow_num(num1)%y
return mod_num;
Answer
import math
def pow_num(a):#function for multiplication
power=(a*a);
return power; #return value
def mod_num(y):
num1=int(input("input the number one: "))#input
from user for num1
modulus=pow_num(num1)%y
return mod_num;
#Sample run