Ass 1

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 3

vat

Withtax = input("Enter the price of an article including VAT:")


float(Withtax)
Withouttax1 = (float(Withtax)/121*100)
Withouttax2 = "{:.2f}".format(Withouttax1)
print("This article will cost", Withouttax2, "without 21.00% VAT")

plumber
Wage = float(input("Enter the hourly wages:"))
Hours_worked = float(input("Enter the number of hours worked:"))
Call_out = 16.00
Hours_worked_round =
Total_Cost = ((Hours_worked_round * Wage) + Call_out)
print("The total cost of this repair is:", Total_Cost, "euro")

othello 1
White_Pieces = int(input('Please enter the percentage of white
pieces:'))
Black_Pieces = int(input("Please enter the percentage of black
pieces:"))
Percentage_black_board = Black_Pieces/64*100
Total_pieces = (Black_Pieces + White_Pieces)
Percentage_black_pieces = Black_Pieces/Total_pieces *100
round_board = round(Percentage_black_board, 2)
round_piece = round(Percentage_black_pieces, 2)
print("The percentage of black pieces on the board is:",
round_board,"%")
print("The percentage of black pieces of all the pieces on the board
is:", round_piece,"%")

electronics
First_article: int = int(input("Enter the price of the first
article:"))
Second_article = int(input("Enter the price of the second
article:"))
Third_article = int(input("Enter the price of the third article:"))
if (First_article > Second_article) & (First_article >
Third_article):
Discount = First_article * 0.15
Total = 0.85*First_article + Second_article + Third_article
elif (Second_article > First_article) & (Second_article >
Third_article):
Discount = Second_article * 0.15
Total = 0.85*Second_article + First_article + Third_article
else:
Discount = Third_article *0.15
Total = 0.85*Third_article+First_article+Second_article
round_discount = '{0:.2f}'.format(Discount)
round_total = "{0:.2f}".format(Total)
print("Discount:", round_discount)
print("Total:", round_total)

othello 2
import time
Black = int(input("Enter the time the black player thought:"))
White = int(input("Enter the time the white player thought:"))
if (Black<White):
Thinking_time =round(White/1000)
Military_time = time.strftime("%H:%M:%S",
time.gmtime(Thinking_time))
print("The time the human player has spent thinking
is:",Military_time)
else:
Thinking_time =round(Black/1000)
Military_time = time.strftime("%H:%M:%S",
time.gmtime(Thinking_time))
print("The time the human player has spent thinking is:",
Military_time)

manny
Donation = 0
while Donation < 50:
Donation = int(input("Enter the amount you want to donate:"))
print("Thank you very much for your contribution of",
format(Donation, '.2f'), "euro.")

alphabet
alphabet = ["a", "b", "c","d",
"e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u",
"v","w","x","y","z"]
ord(alphabet)
chr(alphabet)
print (alphabet)

collatz
Integer = int(input("Please enter a number: "))
List_of_numbers = []
while Integer != 1:
if (Integer % 2)==0:
Integer = (Integer/2)
else: Integer = (Integer*3 + 1)
List_of_numbers.append(Integer)
print (List_of_numbers)

second smallest
Numbers = int(input("Please enter some numbers: "))
Numbers_split = Numbers.split(" ")
Amount_of_numbers = len(Numbers)
for i in range (0,Amount_of_numbers ):

bubblesort
Number = int(input("Please enter some numbers: "))
Array = Number().split(' ')
Array = [int(num) for num in Array]
print (Array)

You might also like