Bottom Page

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 Int error on line 70
#1
import time
import os
import sys
import colorama
from colorama import Fore, Back, Style

cm = input(Fore.GREEN + "please enter your current usage for main: "+ Fore.WHITE)
time.sleep(0.5)
os.system("clear")
cma = input(Fore.GREEN + "please enter your current usage for marina: "+ Fore.WHITE)
time.sleep(0.5)
os.system("clear")
ca = input(Fore.GREEN + "please enter your current usage for annette: "+ Fore.WHITE)
time.sleep(0.5)
os.system("clear")
pm = input(Fore.GREEN + "please enter the previous usage for main: "+ Fore.WHITE)
time.sleep(0.5)
os.system("clear")
pma = input(Fore.GREEN + "please enter the previous usage for marina: "+ Fore.WHITE)
time.sleep(0.5)
os.system("clear")
pa = input(Fore.GREEN + "please enter the previous usage for annetta: "+ Fore.WHITE)
time.sleep(0.5)
os.system("clear")
cm = int(cm)
pm = int(pm)
cma = int(cma)
pma = int(pma)
ca = int(ca)
pa = int(pa)
mu = cm - pm
mau = cma - pma
au = ca - pa
su1 = mau + au
su2 = mu - su1
mu = str(mu)
mau = str(mau)
au = str(au)
su2 = str(su2)
print(Fore.GREEN + "your usage for main is " + mu)
print(Fore.GREEN + "your usage for marina is " + mau)
print(Fore.GREEN + "your usage for annette is " + au)
print(Fore.GREEN + "your usage for the shop is " + su2)
time.sleep(5)
os.system("clear")
print(Fore.GREEN + "now calulating the Percentage's")
time.sleep(3)
os.system("clear")
mau = int(mau)
mu = int(mu)
au = int(au)
su2 = int(su2)
maper = mau / mu
aper = au / mu
sper = su2 / mu 
maper = str(maper)
aper = str(aper)
sper = str(sper)
print(Fore.GREEN + "marina's percentage of use is " + maper)
print(Fore.GREEN + "annetta's percentage of use is " + aper)
print(Fore.GREEN + "the shop's percentage of use is " + sper)
time.sleep(5)
os.system("clear")
bill = input(Fore.GREEN + "please enter the total cost of your bill" + Fore.WHITE)
time.sleep(3)
os.system("clear")
print(Fore.GREEN + "now calculating the amount due for each person: ")
time.sleep(3)
os.system("clear")
bill = int(bill)
maper = int(maper)
aper = int(aper)
sper = int(sper)
madue = maper * bill
adue = aper * bill
sdue = sper * bill
madue = str(madue)
adue = str(adue)
sdue = str(sdue)
print(Fore.GREEN + "Marina need to pay " + madue)
print(Fore.GREEN + "annette need to pay " + adue)
print(Fore.GREEN + "the shop needs to pay " + sdue)
SO i am making a program for my grampa that calculates his energy bill for him and i am having a problem converting a the bill cost from a str to a int on line 70 it keeps giving me a value error and i cant fix it the number i have been using to test the bill cost is 157.54 if that has anything to do with it so can any of you please help
~~ UwU
Quote
#2
Right before line 70 print(bill) and print(type(bill)). That may give a clue. Looks like that line should not give an error.
Quote
#3
If you want to be able to enter 157.54 you need to convert to a float instead of an int
bill = float(bill)
bowlofred likes this post
Quote
#4
Don't repeat yourself (DRY)

Think how you can change your code, to remove repeating code. Hint: loops, data structures. You may also break your code into small reusable chunks - functions
Quote

Top Page

Possibly Related Threads...
Thread Author Replies Views Last Post
  Pyinstaller create this error :“File ”multiprocessing\connection.py“, line 691 Formationgrowthhacking 2 168 Apr-30-2020, 10:26 AM
Last Post: buran
  EOFError: EOF when reading a line - Runtime Error RavCOder 6 2,981 Sep-27-2019, 12:22 PM
Last Post: RavCOder
  Error :unable to detect undefined names created in spyder ide error at line 2 milind_eac 2 1,364 Jul-30-2019, 10:29 PM
Last Post: milind_eac
  Why do i have invalid syntax on a line after print, i see no error ? iofhua 5 569 May-24-2019, 05:42 PM
Last Post: Yoriz
  classes , error at line 88 name finnKategori not defined sydlender 3 802 Nov-12-2018, 09:08 PM
Last Post: buran
  Syntax error in if line daniel 5 2,489 Jul-24-2017, 09:06 AM
Last Post: DeaD_EyE

Forum Jump:


Users browsing this thread: 1 Guest(s)