Professional Documents
Culture Documents
ipynb - Colaboratory
numbers = input("Please enter three numbers with a space: ")
numbers = numbers.split()#Create list
max = numbers[0]
if numbers[1] > max:
if numbers[1] > numbers[2]:
largest = numbers[1]
else:
largest = numbers[2]
elif numbers[2] > max:
largest = numbers[2]
else:
largest = max
print(f"The largest number is {largest}")
name = input("Please enter your name: ")
address = input("Please enter your address: ")
previous = int(input("Please enter previous amount of water in m3: "))
new = int(input("Please eneter current amount of water in m3: "))
wateramount = new - previous
if wateramount <= 1000:
bill = 0.05 * wateramount
elif wateramount > 1000 and wateramount <= 2000:
wateramount2 = wateramount - 1000
bill = 0.05 * 1000 + 0.07 * wateramount2
else:
wateramount3 = wateramount - 2000
bill = 0.05 * 1000 + 0.07 * 1000 + 0.1 * wateramount3
water_bill = '%.2f'% bill
print(f"Name:{name}\nAddress:{address}\nYour water bill owes to Perak Water is:RM{water_bill}")
next != 'Q'
while next != 'Q':
year = int(input("Please enter year: "))
weight = float(input("Please vehicle weightin \'kg\': "))
if year <=1970:
if weight<=1225:
fee = 16.50
elif 1226 <= weight <=1724:
fee = 25.50
else:
fee = 46.50
elif 1971 <= year <= 1979:
if weight<=1225:
fee = 27.00
elif 1226 <= weight <=1724:
fee = 30.50
else:
fee = 52.50
else:
if weight<=1588:
fee = 19.50
else:
fee = 52.50
final = '%.2f' % fee
print(f'Your registration fee of {year} and {weight}kg is RM{final}.')
next = input("Do u want to continue, if no press \'Q\': ")
year = int(input("Please enter the year: "))
if year % 4 == 0:#find modulus
if year % 100 == 0 and year % 400 != 0:
https://colab.research.google.com/drive/1Mbjka1WKDRcV0xHrxdMdxxRn9ParL-_X#scrollTo=3csimmDDIOl_&printMode=true 1/2
2/16/23, 8:54 PM Lab4.ipynb - Colaboratory
y y
answer = f'{year} is not a leap year'
elif year % 100 == 0 and year % 400 == 0:
answer = f'{year} is a leap year'
elif year % 100 != 0:
answer = f'{year} is a leap year'
elif year % 100 != 0 and year % 400 == 0:
answer = f'{year} is not a leap year'
else:
answer = f'{year} is a leap year'
else:
answer = f'{year} is not a leap year'
print(answer)
https://colab.research.google.com/drive/1Mbjka1WKDRcV0xHrxdMdxxRn9ParL-_X#scrollTo=3csimmDDIOl_&printMode=true 2/2