lundi 14 mars 2022

How to shuffle and print a list of emoji using python?

I want to generate emojis in a random way. I tried two different methods but still not habing an output mixed

import random

soleillever ="\U0001f305"
Soleildodo = "\U0001f634"
nuage = '\u2601'
soleilnuage = "\U0001f326"
nuageeclair = "\U0001f329"
rainbow = '\U0001f308'
termo = '\U0001F321'
soleil = '\U0001f31e'
soleil2 = "\U0001f31d"
nuageeclairpluie = "\u26C8"
flocon = "\u2744"
print(soleil,soleil2,termo,rainbow,nuageeclair,soleilnuage,nuage,flocon)


a =[rainbow + nuageeclair + soleilnuage + nuage + soleil2 + nuageeclairpluie + flocon + rainbow]
b = random.sample(a, k=len(a))
print(b)


a1 = [rainbow + nuageeclair + soleilnuage + nuage + soleil2 + nuageeclairpluie + flocon + rainbow]
b1 = random.shuffle(a1)
print(b1)

Here is the output with the type

['đŸŒˆđŸŒ©đŸŒŠ☁🌝⛈❄🌈']
 Here is b <class 'list'>

B1 gives me None
Here is b1<class 'NoneType'>

If someone have an advice, I will appreciate ! B.




Aucun commentaire:

Enregistrer un commentaire