write a python program to create dictionary to store access and liability and capital of a company after creating a dictionary display assets and liabilities of the company and test if the accounting equation holds true
Answers
n = int(input("Enter the number of entries: "))
acc_dict = dict()
print()
for i in range(n):
com = input("Enter the name of the company: ")
a = float(input("Enter the asset amount: "))
l = float(input("Enter the liability amount: "))
c = float(input("Enter the capital amount: "))
acc_dict[com] = a, l, c
print()
print()
print("Your given dictionary: ")
print()
print("Company\t", "Asset\t", "Liability\t", "Capital\t")
print()
for i in acc_dict:
print(i, "\t", acc_dict[i][0], "\t", acc_dict[i][1], "\t", acc_dict[i][2])
print()
for i in acc_dict:
if acc_dict[i][1] + acc_dict[i][2] == acc_dict[i][0]:
print("The accounting equation for", i, "holds TRUE.")
else:
print("The accounting equation for", i, "does NOT hold true.")
Answer:
ㅐ Explanation:
n int(input("Enter the number of entries: "))
acc_dict = dict()
print()
for i in range(n):
com = input("Enter the name of the company: ")
a = float(input("Enter the asset amount: "))
l = float(input("Enter the liability amount: "))
c = float(input("Enter the capital amount: "))
acc_dict[com] = a, l, c
print()
print()
print("Your given dictionary: ")
print()
print("Company\t", "Asset\t", "Liability\t", "Capital\t")
print()
for i in acc_dict:
print(i, "\t", acc_dict[i][0], "\t", acc_dict[i][1], "\t", acc_dict[i][2])
print()
for i in acc_dict:
if acc_dict[i][1] + acc_dict[i][2] == acc_dict[i][0]:
print("The accounting equation for", i, "holds TRUE.")
else:
print("The accounting equation for", i, "does NOT hold true.")