

You are probably compelled to keep on trying until you get 'evil professors'. 'green professors' > random.choice(adj) + " " + random.choice(n) # Don't re-type the whole thing! Use Alt+p or Ctrl+p. 'sad pandas' > random.choice(adj) + " " + random.choice(n) > random.choice(adj) + " " + random.choice(n) Seems pretty straightforward: given a list as the argument, random.choice() chooses an element at random and returns it. Again, don't forget to prefix random when referencing choice(). choice() does, using the built-in help() function. 'triangular', 'uniform', 'vonmisesvariate', 'weibullvariate'] > 'paretovariate', 'randint', 'random', 'randrange', 'sample', 'seed', 'setstate', 'shuffle', 'gammavariate', 'gauss', 'getrandbits', 'getstate', 'lognormvariate', 'normalvariate', '_sqrt', '_test', '_test_generator', '_urandom', '_warn', 'betavariate', 'choice', 'expovariate', ['BPF', 'LOG4', 'NV_MAGICCONST', 'RECIP_BPF', 'Random', 'SG_MAGICCONST', 'SystemRandom', Let's first import it, and then see what functions are available using dir(): are packaged as part of the math module, which should be imported first before you can use them. (Can you imagine a programmig language without + or -? Neither can I.) But additional math functions such as square root, logarithm, factorial, etc.

They are simply accessible, no additional step needed. We have seen some familiar math functions: operators such as +, / and functions such as sum() are used so frequently that they are included as built-ins. (Hence the import antigravity line from the the xkcd comic on the tutorial home! You should try the command, btw.) The utility of the import statement is more general, however: it is used to import any external modules with pre-written functions you can easily access and utilize. You achieve this through the import statement.
#Python ilibrary installed but not imported how to
In this video tutorial, we learned how to import a Python script you yourself created as a module and re-use the functions you built earlier.

On this page: import, the math module, math.sqrt(), the random module, random.choice(), the nltk package, nltk.word_tokenize(), importing functions with from m import x, aliasing with from m import x as y.
