[Tutor] Project Question: HELP ME SIR

Alan Gauld learn2program at gmail.com
Wed May 11 18:47:00 EDT 2022


On 11/05/2022 16:27, Rex Oni wrote:
> We need to import two modules for myPythonFunctions.py: the
> random module and the os module.

This sounds like a homework? We won't do your homework.

How to import modules should be covered very early in any Python tutorial.

You basically can't do much without importing things...

> We’ll be using the randint() function from the random module. 
> From the os module, we’ll be using the remove() and rename()
> functions.

What have you tried?

There are several different import options, each has value depending
on what you need.

import MODULE [as alias]

from MODULE import NAME [ as alias]

import * from MODULE      # usually only at the >>> prompt

Read the docs to decide which is most appropriate for you.

-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos



More information about the Tutor mailing list