-1

I am a begginer in Python. I am writting this exercise to practice and found one way to do it, when I thought about doing it another way, it didn't work. It's probably a organization error, but I can't see it. Please take it easy to explain.

shuffle(list)
print('The new order is {}'.format(list))

That works.

print('The new order is{}'.format(shuffle(lista)))

That doesn't. I know it's simple but I have no one here to help me solve that doubt. Thanks.

1 Answers1

0

I expect that shuffle shuffles the list in place, but returns None as its value. Your second syntax requires a new version of the list to be returned.

Also, note that list is a built-in type. Don't use pre-defined identifiers as your personal variables.

Prune
  • 76,765
  • 14
  • 60
  • 81