Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import os #Imports Operating System Library
- import time #Imports Time Library
- #CUSTOMER ID SECTION
- while True:
- print ("What is your first initial?")
- Initial = input ("")
- if Initial.isalpha() and len(Initial) == 1: #.isalpha checks if the variable is made from letters.
- print ("First Initial is " + Initial.upper()) #.upper makes the variable all capital letters.
- print ("")
- break
- else:
- print ("Please enter your first initial only")
- while True :
- print ("What is your Surname?")
- Surname = input ("")
- if Surname.isalpha():
- print ("Surname is " + Surname.title()) #.title makes the variable begin with a capital letter, and then lower case letters.
- print ("")
- break
- else:
- print ("Please enter a Surname")
- Customer_Name = Initial.title() + Surname.title()
- print ("Your customer name is " + Customer_Name)
- print ("")
- #CUSTOMER ID SECTION
- time.sleep(3) #time.sleep makes the program wait a specified amount of time before continuing.
- #CLEAR DEFINITION
- #This section creates a definition to clear the screen.
- def Clear():
- clear = lambda: os.system ('cls')
- clear()
- Clear()
- #CLEAR DEFINITION
- #ADDRESS SECTION
- while True :
- print ("What is your house number?")
- House_Number = input ("")
- if House_Number.isnumeric(): #.isnumeric checks if the variable is all numbers.
- print("Your house number is " + House_Number)
- print("")
- break
- else:
- print ("Please enter a house number")
- while True:
- print ("What is the name of the road you live on? (Do not state the address suffix and don't use spaces)")
- Road_Name = input("")
- if Road_Name.isalpha():
- print("Your road name is " + Road_Name.title())
- print("")
- break
- else:
- print("Please enter your road name")
- while True:
- print ("What is your address suffix?")
- Address_Suffix = input("")
- if Address_Suffix.isalpha():
- print ("Your address suffix is " + Address_Suffix.title())
- print ("")
- break
- else:
- print ("Please enter you address suffix")
- Address_Complete = House_Number + " " + Road_Name.title() + " " + Address_Suffix.title()
- print ("Your address is " + Address_Complete)
- print (" ")
- #ADDRESS SECTION
- time.sleep(3)
- Clear()
- #DATE
- print ("What is the date today? (dd/mm/yy)")
- Date = input("")
- print ("The date today is " + Date)
- print (" ")
- #DATE
- time.sleep(3)
- Clear()
- #CUSTOMER ID
- print("Your customer ID is: " + Customer_Name + Road_Name.title())
- #CUSTOEMER ID
- time.sleep(5)
- Clear()
- #AREA OF WALLS
- #WALL 1
- while True:
- print ("What is the height of Wall 1? (Between 2.4m and 6.0m)(DO NOT TYPE M)")
- WallHeight_1 = input ("")
- if WallHeight_1.isalpha():
- print ("Please enter a number between 2.4m and 6.0m.")
- else:
- fltWallHeight_1 = float (WallHeight_1)
- if fltWallHeight_1 >= 2.4 and fltWallHeight_1 <= 6.0:
- print ("The height of Wall 1 is " + WallHeight_1 + "m")
- print (" ")
- break
- else:
- print ("Please enter a correct height")
- while True:
- print ("What is the width of Wall 1? (Between 1.0m and 25.0m)(DO NOT TYPE M)")
- WallWidth_1 = input ("")
- if WallWidth_1.isalpha():
- print ("Please enter a number between 1.0m and 25.0m.")
- else:
- fltWallWidth_1 = float (WallWidth_1)
- if fltWallWidth_1 >= 1.0 and fltWallWidth_1 <= 25.0:
- print ("The width of Wall 1 is " + WallWidth_1 + "m")
- print (" ")
- break
- else:
- print ("Please enter a correct Width")
- WallArea_1 = fltWallHeight_1 * fltWallWidth_1
- strWallArea_1 = str (WallArea_1)
- print ("The area of Wall 1 is " + format(WallArea_1, '.2f') + "m squared.")
- #WALL 1
- time.sleep(3)
- Clear()
- #WALL 2
- while True:
- print ("What is the height of Wall 2? (Between 2.4m and 6.0m)(DO NOT TYPE M)")
- WallHeight_2 = input ("")
- if WallHeight_2.isalpha():
- print ("Please enter a number between 2.4m and 6.0m.")
- else:
- fltWallHeight_2 = float (WallHeight_2)
- if fltWallHeight_2 >= 2.4 and fltWallHeight_2 <= 6.0:
- print ("The height of Wall 2 is " + WallHeight_2 + "m")
- print (" ")
- break
- else:
- print ("Please enter a correct height")
- while True:
- print ("What is the width of Wall 2? (Between 1.0m and 25.0m)(DO NOT TYPE M)")
- WallWidth_2 = input ("")
- if WallWidth_2.isalpha():
- print ("Please enter a number between 1.0m and 25.0m.")
- else:
- fltWallWidth_2 = float (WallWidth_2)
- if fltWallWidth_2 >= 1.0 and fltWallWidth_2 <= 25.0:
- print ("The width of Wall 2 is " + WallWidth_2 + "m")
- print (" ")
- break
- else:
- print ("Please enter a correct Width")
- WallArea_2 = fltWallHeight_2 * fltWallWidth_2
- strWallArea_2 = str (WallArea_2)
- print ("The area of Wall 2 is " + format(WallArea_2, '.2f') + "m squared.")
- #WALL 2
- time.sleep(3)
- Clear()
- #WALL 3
- while True:
- print ("What is the height of Wall 3? (Between 2.4m and 6.0m)(DO NOT TYPE M)")
- WallHeight_3 = input ("")
- if WallHeight_3.isalpha():
- print ("Please enter a number between 2.4m and 6.0m.")
- else:
- fltWallHeight_3 = float (WallHeight_3)
- if fltWallHeight_3 >= 2.4 and fltWallHeight_3 <= 6.0:
- print ("The height of Wall 3 is " + WallHeight_3 + "m")
- print (" ")
- break
- else:
- print ("Please enter a correct height")
- while True:
- print ("What is the width of Wall 3? (Between 1.0m and 25.0m)(DO NOT TYPE M)")
- WallWidth_3 = input ("")
- if WallWidth_3.isalpha():
- print ("Please enter a number between 1.0m and 25.0m.")
- else:
- fltWallWidth_3 = float (WallWidth_3)
- if fltWallWidth_3 >= 1.0 and fltWallWidth_3 <= 25.0:
- print ("The width of Wall 3 is " + WallWidth_3 + "m")
- print (" ")
- break
- else:
- print ("Please enter a correct Width")
- WallArea_3 = fltWallHeight_3 * fltWallWidth_3
- strWallArea_3 = str (WallArea_3)
- print ("The area of Wall 3 is " + format(WallArea_3, '.2f') + "m squared.")
- #WALL 3
- time.sleep(3)
- Clear()
- #WALL 4
- while True:
- print ("What is the height of Wall 4? (Between 2.4m and 6.0m)(DO NOT TYPE M)")
- WallHeight_4 = input ("")
- if WallHeight_4.isalpha():
- print ("Please enter a number between 2.4m and 6.0m.")
- else:
- fltWallHeight_4 = float (WallHeight_4)
- if fltWallHeight_4 >= 2.4 and fltWallHeight_4 <= 6.0:
- print ("The height of Wall 4 is " + WallHeight_4 + "m")
- print (" ")
- break
- else:
- print ("Please enter a correct height")
- while True:
- print ("What is the width of Wall 4? (Between 1.0m and 25.0m)(DO NOT TYPE M)")
- WallWidth_4 = input ("")
- if WallWidth_4.isalpha():
- print ("Please enter a number between 1.0m and 25.0m.")
- else:
- fltWallWidth_4 = float (WallWidth_4)
- if fltWallWidth_4 >= 1.0 and fltWallWidth_4 <= 25.0:
- print ("The width of Wall 4 is " + WallWidth_4 + "m")
- print (" ")
- break
- else:
- print ("Please enter a correct Width")
- WallArea_4 = fltWallHeight_4 * fltWallWidth_4
- strWallArea_4 = str (WallArea_4)
- print ("The area of Wall 4 is " + format(WallArea_4, '.2f') + "m squared.")
- #WALL 4
- time.sleep(3)
- Clear()
- #AREA
- WallsArea = WallArea_1 + WallArea_2 + WallArea_3 + WallArea_4
- strWallsArea = str (WallsArea)
- print ("The area of all the walls is " + format(WallsArea, '.2f') + "m squared.")
- #AREA
- time.sleep(3)
- Clear()
- #AREA OF WALLS FINISHED
- #AREA OF WINDOW
- while True:
- print ("What is the height of the Window? (Between 0.9m and 1.5m)(DO NOT TYPE M)")
- WindowHeight = input ("")
- if WindowHeight.isalpha():
- print ("Please enter a number between 0.9m and 1.5m")
- else:
- fltWindowHeight = float (WindowHeight)
- if fltWindowHeight >= 0.9 and fltWindowHeight <= 1.5:
- print ("The height of the Window is " + format(fltWindowHeight, '.2f') + "m")
- print (" ")
- break
- else:
- print ("Please enter a correct height")
- while True:
- print ("What is the width of the Window? (Between 0.9m and 2.0m)(DO NOT TYPE M)")
- WindowWidth = input ("")
- if WindowWidth.isalpha():
- print ("Please enter a number between 0.9m and 2.0m.")
- else:
- fltWindowWidth = float (WindowWidth)
- if fltWindowWidth >= 0.9 and fltWindowWidth <= 2.0:
- print ("The width of the Window is " + format(fltWindowWidth, '.2f') + "m")
- print (" ")
- break
- else:
- print ("Please enter a correct Width")
- WindowArea = fltWindowHeight * fltWindowWidth
- strWindowArea = str (WindowArea)
- print ("The area of the Window is " + format(WindowArea, '.2f') + "m squared.")
- #AREA OF WINDOW
- time.sleep(3)
- Clear()
- #AREA
- RemoveArea = WindowArea
- PaintArea = WallsArea - RemoveArea
- strPaintArea = str(PaintArea)
- print ("The area of the walls is " + format(WallsArea, '.2f') + "m squared")
- time.sleep(2)
- print ("The area of the window is " + format(WindowArea, '.2f') + "m squared")
- time.sleep(2)
- print (" ")
- print (" ")
- print ("The area of what needs to be painted is " + format(PaintArea, '.2f') + "m squared")
- #AREA
- time.sleep(3)
- Clear()
- #PAINT
- Luxury_Paint = 1.75
- Standard_Paint = 1.00
- Economy_Paint = 0.80
- print ("Luxury paint is £1.75 per square metre.")
- print ("Standard paint is £1.00 per square metre.")
- print ("Economy paint is £0.80 per square metre.")
- print (" ")
- while True:
- print ("What type of paint is required? (Please enter Luxury, Standard or Economy)")
- Required_Paint = input ("")
- if Required_Paint.lower() == "luxury":
- PaintTypePrice = Luxury_Paint
- break
- elif Required_Paint.lower() == "standard":
- PaintTypePrice = Standard_Paint
- break
- elif Required_Paint.lower() == "economy":
- PaintTypePrice = Economy_Paint
- break
- else:
- print ("Please enter a correct paint type.")
- strRequired_Paint = str(Required_Paint)
- strPaintTypePrice = str(PaintTypePrice)
- print (" ")
- print ("The type of paint required is " + strRequired_Paint.title() + " and this costs £" + strPaintTypePrice + " per square metre.")
- print (" ")
- Full_Price = PaintTypePrice * PaintArea
- strFull_Price = str(Full_Price)
- print ("The price of the amount of " + strRequired_Paint.title() + " paint required to paint the walls is £" + format(Full_Price, '.2f'))
- #PAINT
- time.sleep(3)
- Clear()
- #UNDERCOAT
- Undercoat = 0.45
- while True:
- print ("Is an Undercoat required?")
- Undercoat_Required = input ("")
- if Undercoat_Required.lower() == "yes":
- Undercoat_Price = Undercoat * PaintArea
- strUndercoat_Price = str(Undercoat_Price)
- print (" ")
- print ("The full price of the undercoat will be £" + format(Undercoat_Price, '.2f'))
- Full_Price2 = Full_Price + Undercoat_Price
- strFull_Price2 = str(Full_Price2)
- print ("The full price is now £" + format(Full_Price2, '.2f'))
- break
- elif Undercoat_Required.lower() == "no":
- Undercoat_Price = 0
- Full_Price2 = Full_Price + Undercoat_Price
- strFull_Price2 = str(Full_Price2)
- strUndercoat_Price = str(Undercoat_Price)
- break
- else:
- print ("Please enter Yes or No.")
- #UNDERCOAT
- time.sleep(3)
- Clear()
- #FILE CREATING
- #This section creates a document and adds the users information.
- def filemake():
- file = Customer_Name+Road_Name
- Info = open(file+'.txt', 'a')
- Info.write(Customer_Name + '\n')
- Info.write(Address_Complete + '\n')
- Info.write(Date + '\n')
- Info.write("Undercoat: " + Undercoat_Required.title() + '\n')
- Info.write("Undercoat price: £" + format(Undercoat_Price, '.2f') + '\n')
- Info.write("Paint type: " + Required_Paint.title() + '\n')
- Info.write("Paint price: £" + format(Full_Price, '.2f') + '\n')
- Info.write("Overall price: £" + format(Full_Price2, '.2f') + '\n')
- Info.write('\n')
- Info.close()
- filemake()
- #FILE CREATING
- #FINAL INFO
- print ("FINAL INFORMATION")
- time.sleep(1)
- print ("Undercoat price = £" + format(Undercoat_Price, '.2f'))
- time.sleep(1)
- print ("Overcoat price = £" + format(Full_Price, '.2f'))
- time.sleep(1)
- print ("Final price = £" + format (Full_Price2, '.2f'))
- time.sleep(3)
- print ("Ending the program in...")
- time.sleep(0.5)
- print ("3")
- time.sleep(1)
- print ("2")
- time.sleep(1)
- print ("1")
- time.sleep(1)
- exit()
- #FINAL INFO
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement