Help me with my code please

something wrong with my code, can some one help me? I need to do this task: a*(4*b-a)



Hi @IghorPaniotov, welcome to the community!

I guess this is a logic error. Python follows PEMDAS, so update your print statement to:

Looks like a school task. So all i can say is to look carefully at what you are multiply in the print statement and what you actually should multiply.
There is an error there.

You are actually correct with the print statement.
a×(4b-a) = 4ab - a² by distributive law.

Your mistake and clue to fix:

The error here is that you forgot to change datatype of the values.
Remember: input() function always retuns values in str datatype (string)
Take care of that to fix it

What your code does now:

So there is another functionality of * operator which is string replication.
You can use it when int * str or str * int

For example:

2 * "hi"
4* "5"
1 Like

Before giving basically a full answer, please make sure this is not a school assignment and giving as much of an information as you did is basically cheating.

1 Like

Alright, removed. Now there is just a clue

1 Like