J.DoeFizzer - 5 days ago 3x
Python Question

# Why is this piece of code not working?

I am currently doing a project for school in which I am supposed to make a dice game. Here is the code:

``````Roll = input("Do you want to Roll or Stick?")
if Roll in ("Roll" , "roll"):
print("Your new numbers are," , +number10 , +number20 , +number30 , +number40 , +number50)

KeepDelete = input("Would you like to keep or delete a number?")
if KeepDelete in("Keep", "keep"):
print("Your numbers are," , +number10 , +number20 , +number30 , +number40 , +number50)
print("Your final score is," , number10+number20+number30+number40+number50)
if KeepDelete in("Delete", "delete"):
Delete = int(input("What number would you like to delete?"))

if Delete == (number10):
del(number10)
Score1 = int("Your numbers are" , number100 , number20 , number30 , number40 , number50)
print("Your final score is" , +number100 + number20 + number30 +number40 + number50)

if Delete == (number20):
del(number20)
Score2 = int("Your numbers are" , number10 , number200 , number30 , number40 , number50)
print("Your final score is" , +number10 + number200 + number30 + number40 + number50)

if Delete == (number30):
del(number30)
Score3 = int("Your numbers are" , number10 , number20 , number300 , number40 , number50)
print("Your final score is" , +number10 + number20 +number300 + number40 + number50)

if Delete == (number40):
del(number40)
Score4 = int("Your numbers are" , number10 , number20 , number30 , number400 , number50)
print("Your final score is" +number10 + number20 + number30 + number400 + number50)

if Delete == (number50):
del(number50)
Score5 = int("Your numbers are" , number10 , number20 , number30 , number40 , number500)
print("Your final score is" +number10 + number20 + number30 + number40 + number500)
``````

Here is the error code:

``````Score1 = int("Your numbers are" , number100 , number20 , number30 , number40 , number50)
TypeError: int() takes at most 2 arguments (6 given)
``````

Sorry for such a long piece but I have been confused on this for about six hours. Any help would be appreciated.

Just taking a section of your code:

``````print("Your final score is," , number10+number20+number30+number40+number50)
if KeepDelete in("Delete", "delete"):
Delete = int(input("What number would you like to delete?"))

if Delete == (number10):
del(number10)
Score1 = int("Your numbers are" , number100 , number20 , number30 , number40 , number50)
print("Your final score is" , +number100 + number20 + number30 +number40 + number50)
``````

int() casts the arguments to integer format. The error message is telling you it takes two arguments: 1) the value to be converted and 2) the base.

So in:

``````Delete = int(input("What number would you like to delete?"))
``````

You're trying to cast the argument `input("What..."))` to an integer.

In the specific error message you're getting, you're trying to cast `"your numbers are"` and all of the subsequent variables to `int`, and pass that to the variable Score 1. Python doesn't know where to start with that.