SHARE
TWEET

Untitled

a guest Oct 22nd, 2019 68 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. def CancelOrders():
  2.     while True:
  3.         orderID = input("Please enter your order ID (You will need to pay 20% of the total price): ")
  4.         with open('Temp.txt') as f:
  5.             if orderID in f.read():
  6.                 print("You have paid")
  7.                 f.seek(0)
  8.                 total = 0
  9.                 for line in f:
  10.                     if orderID in line:
  11.                         total_price = line[48:60]
  12.                         total = total_price
  13.                 total = float(total)
  14.                 total = total*0.2
  15.                 total = (round(total, 2))
  16.                 finaltotal = total
  17.                 print("Your total is: "+str(finaltotal))
  18.                 lines = f.readlines()
  19.                 f = open("Temp.txt","w+")
  20.                 for line in lines:
  21.                     if line[0:12].lower().strip() != orderID.lower().strip():
  22.                         f.write(line)
  23.                 f.close()
  24.                 break
  25.             else:
  26.                 print("OrderID does not exist.")
  27.                 Menu()
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top