sahanjb
sahanjb

Reputation: 23

How do I solve TypeError: pow() takes exactly 2 arguments (3 given)?

I made a small program that can solve RSA math questions. One part of the program checks if the ciphertext is needed, and if the plaintext, e and n are given.

When executing the code I get an error: TypeError: pow() takes exactly 2 arguments (3 given) Even though pow() can take 3 arguments https://www.programiz.com/python-programming/methods/built-in/pow

if "ciphertext" in NeededObjDict and "plaintext" in GivenObjDict and "e" in GivenObjDict and "n" in GivenObjDict:
        OutputCiphertext = str(pow(GivenPlaintext, GivenE, GivenN))
        print('ciphertext = ',OutputCiphertext)

Upvotes: 1

Views: 1903

Answers (1)

Will C
Will C

Reputation: 317

I think I found the reason for your issue. The built-in pow function takes three arguments as seen here. However the math.pow function takes in two arguments, as seen here

I would check if you're importing pow from math somewhere.

Upvotes: 5

Related Questions