Quantcast

A community for students.

Here's the question you clicked on:

55 members online
  • 0 replying
  • 0 viewing

LoveMathFermat

  • 2 years ago

Hi fellow OCW student, I have a question about ps3b.py homework; writing hangman code computer part. from ps3a import * import time from perm import * what is importing other codes mean? are all the functions from the imported codes allowed to use ?

  • This Question is Open
  1. LoveMathFermat
    • 2 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    *correction-a word game, not hangman.

  2. bwCA
    • 2 years ago
    Best Response
    You've already chosen the best response.
    Medals 1

    yep, the objects from those modules will be available in the local namespace.

  3. rsmith6559
    • 2 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    The import statement imports ( brings in to ) other modules and libraries into your program. The two types of import statement that you have import things differently. import time imports the time module into your program, but in it's own namespace. To get the localtime, you have to call time's functions with time as the namespace: time.localtime( time.time() ) from perm import * imports all ( * ) of perm's functions into the local namespace. To use one of perm's functions or objects, you don't have to preface it with perm. Some other languages like C #include instead of import their libraries. Usage wise, it's basically the same.

  4. Not the answer you are looking for?
    Search for more explanations.

    • Attachments:

Ask your own question

Sign Up
Find more explanations on OpenStudy
Privacy Policy

Your question is ready. Sign up for free to start getting answers.

spraguer (Moderator)
5 → View Detailed Profile

is replying to Can someone tell me what button the professor is hitting...

23

  • Teamwork 19 Teammate
  • Problem Solving 19 Hero
  • You have blocked this person.
  • ✔ You're a fan Checking fan status...

Thanks for being so helpful in mathematics. If you are getting quality help, make sure you spread the word about OpenStudy.

This is the testimonial you wrote.
You haven't written a testimonial for Owlfred.