2016-06-21 4 views
-1

私はこのコードを実行したときに、私はこのエラーとValueErrorを取得する「台所」()ベース10とベース10とのint型のための無効なリテラル():「キッチン」

私は、Pythonに非常に新しいですどんな助けでも大歓迎です。 ありがとうございます。

st1 = [] 

number = 0 

room_type =0 

walls=0 

print ("welcome to our painting cost estimate calculator") 
print ("please enter the following information") 


customer_number = input("please enter your telefone number") 


date = input("please enter the date of the estimate \n(in short form)") 

num_rooms = input("please enter the number of rooms that you wish to be painted")     
int(num_rooms) 

while int(room_type) < int(num_rooms): 
    room_type = input("please enter the room name") 
    list1.append(room_type)) 

    while int(walls)< int(room_type): 
     wall = input ("enter the nmber of walls in",room_type,) 
     list1.append (float(2,wall)) 



wallpaper = input("does wallpaper need to be removed (y/n)\nthis costs £70") 
if wallpaper == ("y"): 
    Total_price + 70*(num_rooms) 
if wallpaper == ("n"): 
    measurements() 

def measurements(): 
    measure = input("please enter the dementions for",room_type,"as follows Height/width") 
    list1.insert(2,measure) 
+0

まあ、正確にあなたが整数に ' 'kitchen''を変換しようとすると、それが何を期待する何をすべきか? – jonrsharpe

答えて

0

文字列にint()を呼び出すことはできません。私は失われた瞬間があったので、これはライン

while int(walls)< int(room_type): 
+0

文字列で 'int'を呼び出すことはできますが、整数(' '123''、' '10101''など)を表現している場合を除いて、それは非常に幸せではありません。 – jonrsharpe

0

で起こる:

def getrooms(wall_paper_removal_cost, cost_per_square_meter_paint): 
    num_rooms = input('please input the number of rooms you like to paint:') 
    rooms = [] 
    for i in range(1, int(num_rooms) + 1): 
     print() 
     print ('for room number ' + str(i) + ':') 
     room_name = input('what is the name of the room:') 
     walls = int(input('how many walls need to be painted:')) 
     paper = int(input('how many walls need wall paper removed:')) 
     paper_cost = paper * wall_paper_removal_cost 
     paint_cost = 0 
     for t in range(1, walls + 1): 
      print ('for room ' + room_name + ' wall ' + str(t) + ':') 
      height = int(input('what is the height in meters:')) 
      width = int (input('what is the width in meters:')) 
      paint_cost += height * width * cost_per_square_meter_paint 
     rooms.append([room_name, walls, paper, paper_cost, paint_cost]) 
    return rooms 

def printcost(rooms): 
    # alignment of printing need to be done properly 
    # probably using ''.ljust() and ''.rjust() to make it look good 
    total = 0 
    for i in range(0, len(rooms)): 
     print() 
     print ('Room:' + rooms[i][0]) 
     print (' Number of walls to be painted: ' + str(rooms[i][1])) 
     print ('         cost: ' + str(rooms[i][4])) 
     print (' Number of wallpaper removal : ' + str(rooms[i][2])) 
     print ('         cost: ' + str(rooms[i][3])) 
     total += rooms[i][3] + rooms[i][4] 
    print ('===================================================================') 
    print ('         total: ' + str(total)) 


def main(): 

    # set your costs for calculation 
    cost_per_square_meter_paint = 12 
    wall_paper_removal_cost = 70 

    # get the details of each room 
    rooms = getrooms(wall_paper_removal_cost, cost_per_square_meter_paint) 

    #print out the estimate 
    printcost(rooms) 

    return 

if __name__ == '__main__': 
    main() 
関連する問題