AttributeError:'int'对象没有属性'append'python

时间:2017-01-18 14:52:03

标签: python-3.x

我收到错误

AttributeError: 'int' object has no attribute 'append'

尝试添加

中创建的数据时
measurements(height,walls)

到字典

我想在已经存储在该密钥下的数据旁边添加此数据。

rooms_dict

number = 0
total = 0
room_name_walls = 0
height = 0
width = 0
rooms_dict = {}
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 = int(input("please enter the number of rooms that you wish to be painted"))                 


def room_name():
    height = 0
    total = 0
    width = 0
for k in range (num_rooms):
    rooms_dict[input("please enter the name of room {}".format(k+1))]= int(input("how many walls are there in room {}".format(k+1)))
    wallpaper = input("Does room {} need wallpaper removing 9(y/n)".format(k+1))
    if wallpaper == ("y"):
        total = total +70
        print("£70 added to total")
    if wallpaper == ("n"):
        print("no cost added")
    print(rooms_dict)
return measurements(height,width)

def measurements(height,width):
for k,v in rooms_dict.items():
    checker = 0
    while v > checker:
        height = (input("Please enter the height for one wall  in the {}(m)".format(k)))
        rooms_dict[k].append(height)
        width = (input("Now please enter the width for the same wall in the {} (m)".format(k)))
        rooms_dict[k].append(width)
        checker = checker + 1
        print(numrooms)

感谢您的帮助!!!

0 个答案:

没有答案