jeudi 19 mars 2020

How would i make an input have a small chance of outputting an image

for example:

                        comm = raw_input("Type something you want to say to me > " )
                except: comm = "."

                if comm.lower().strip() == "hi":
                 print "hello"
(10% chance of running this command too) os.system('catimg devil_face.png')

here, catimg is a console command which turns images into ascii coloured characters, and devil_face.png is a scary image i uploaded to the machine.

Aucun commentaire:

Enregistrer un commentaire