2 ms·
I used the prompt ‘Calculate the permutations of the world “safer” in python’ It gave me the correct code (which shows all 120 permutations when ran in Python)
by carl_dr 4y ago
I used the prompt ‘Calculate the permutations of the world “safer” in python’
It gave me the correct code (which shows all 120 permutations when ran in Python) :
import itertools
word = "safer"
# Get all permutations of the word
permutations = itertools.permutations(word)
# Print each permutation
for permutation in permutations:
print(permutation)
It then showed the output, but got it wrong. It listed 24 permutations, then said ‘As you can see, there are 24 possible permutations of the word "safer".‘
Interestingly, if you ask it how many permutations “safer” has, not asking about code, it invents some maths that produces 24 (see my reply in another post), so I guess it’s the understanding of permutations which is off.