I have an assignment for creating cost for a sign. I have done everything for the assignment, and the code even runs perfectly the way it wants it. however, it keeps giving me the error “Reason: Unable to determine color type. Type mismatch: Cannot replace Call with str” which is slicing my grade by 50%.
This is my code. It works fine. For example, it wants the price of a gold text sign, with 8 letters and pine to be 62$ which is what the price ends up being by the end of the program.
<code># Initialize variables here.
print("The first five letters are included in the minimum charge, but each individual character afterwards is an additional 4$")
num_chars = int(input("Enter how many characters you will have on the sign: "))
charge = (num_chars - minChars) * costChars
color = input("Do you wan to pay 15$ additional for gold lettering or black and white: ")
elif color == "black and white":
wood_type = input("Do you wan to pay 20$ additional oak or pine: ")
elif wood_type == "pine":
# Write assignment and if statements here as appropriate.
# Output Charge for this sign.
print(f"The charge for this sign is ${charge:.2f}")`
<code># Initialize variables here.
charge = 0
num_chars = 8
color = "gold"
wood_type = "oak"
minChars = 5
costChars = 4
# Charge for this sign.
# Number of characters.
print("The first five letters are included in the minimum charge, but each individual character afterwards is an additional 4$")
num_chars = int(input("Enter how many characters you will have on the sign: "))
if num_chars > minChars:
charge = (num_chars - minChars) * costChars
# Color of characters.
color = input("Do you wan to pay 15$ additional for gold lettering or black and white: ")
if color == "gold":
charge = charge + 15
elif color == "black and white":
charge
# Type of wood.
wood_type = input("Do you wan to pay 20$ additional oak or pine: ")
if wood_type == "oak":
charge = charge + 20
elif wood_type == "pine":
charge
# Write assignment and if statements here as appropriate.
# Output Charge for this sign.
charge = charge + 35
print(f"The charge for this sign is ${charge:.2f}")`
</code>
# Initialize variables here.
charge = 0
num_chars = 8
color = "gold"
wood_type = "oak"
minChars = 5
costChars = 4
# Charge for this sign.
# Number of characters.
print("The first five letters are included in the minimum charge, but each individual character afterwards is an additional 4$")
num_chars = int(input("Enter how many characters you will have on the sign: "))
if num_chars > minChars:
charge = (num_chars - minChars) * costChars
# Color of characters.
color = input("Do you wan to pay 15$ additional for gold lettering or black and white: ")
if color == "gold":
charge = charge + 15
elif color == "black and white":
charge
# Type of wood.
wood_type = input("Do you wan to pay 20$ additional oak or pine: ")
if wood_type == "oak":
charge = charge + 20
elif wood_type == "pine":
charge
# Write assignment and if statements here as appropriate.
# Output Charge for this sign.
charge = charge + 35
print(f"The charge for this sign is ${charge:.2f}")`
This is the output containing the errors:
Test: Black and white, 5 letter, on pine (minimum charge).
Reason: Unable to determine color type. Type mismatch: Cannot replace Call with str.
Error : ValueError - Unable to determine color type. Type mismatch: Cannot replace Call with str.
Timestamp: 2024-04-27 20:20:03.443145
Test: Gold leaf, 10 letter, on oak.
Reason: Unable to determine color type. Type mismatch: Cannot replace Call with str.
Error : ValueError - Unable to determine color type. Type mismatch: Cannot replace Call with str.
Timestamp: 2024-04-27 20:20:03.443463
Test: Gold leaf, 8 letter, on pine.
Reason: Unable to determine color type. Type mismatch: Cannot replace Call with str.
Error : ValueError - Unable to determine color type. Type mismatch: Cannot replace Call with str.
Timestamp: 2024-04-27 20:20:03.443735
<code>Status: FAILED!
Check: 1
Test: Black and white, 5 letter, on pine (minimum charge).
Reason: Unable to determine color type. Type mismatch: Cannot replace Call with str.
Error : ValueError - Unable to determine color type. Type mismatch: Cannot replace Call with str.
Timestamp: 2024-04-27 20:20:03.443145
Status: FAILED!
Check: 2
Test: Gold leaf, 10 letter, on oak.
Reason: Unable to determine color type. Type mismatch: Cannot replace Call with str.
Error : ValueError - Unable to determine color type. Type mismatch: Cannot replace Call with str.
Timestamp: 2024-04-27 20:20:03.443463
Status: FAILED!
Check: 3
Test: Gold leaf, 8 letter, on pine.
Reason: Unable to determine color type. Type mismatch: Cannot replace Call with str.
Error : ValueError - Unable to determine color type. Type mismatch: Cannot replace Call with str.
Timestamp: 2024-04-27 20:20:03.443735
</code>
Status: FAILED!
Check: 1
Test: Black and white, 5 letter, on pine (minimum charge).
Reason: Unable to determine color type. Type mismatch: Cannot replace Call with str.
Error : ValueError - Unable to determine color type. Type mismatch: Cannot replace Call with str.
Timestamp: 2024-04-27 20:20:03.443145
Status: FAILED!
Check: 2
Test: Gold leaf, 10 letter, on oak.
Reason: Unable to determine color type. Type mismatch: Cannot replace Call with str.
Error : ValueError - Unable to determine color type. Type mismatch: Cannot replace Call with str.
Timestamp: 2024-04-27 20:20:03.443463
Status: FAILED!
Check: 3
Test: Gold leaf, 8 letter, on pine.
Reason: Unable to determine color type. Type mismatch: Cannot replace Call with str.
Error : ValueError - Unable to determine color type. Type mismatch: Cannot replace Call with str.
Timestamp: 2024-04-27 20:20:03.443735
This is the assignment: Assignment