Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6198525
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T04:02:19+00:00 2026-05-24T04:02:19+00:00

I am new to programming and Python. I am following the Learn Python the

  • 0

I am new to programming and Python. I am following the Learn Python the Hard Way book.
As a part of exercise 25, I wrote a script:

def break_words(stuff):   
    """This function will break up words for us."""   
    words = stuff.split(' ')    
    return words        

def sort_words(words):    
    """Sorts the words."""    
    return sorted(words)        

def print_first_word(words):    
    """Prints the first words after popping it off."""    
    word = words.pop(0)    
    print word
        
def print_last_word(words):    
    """Prints the last word after popping it off."""    
    word = words.pop(-1)    
    print word    
    
def sort_sentence(sentence):    
    """Takes in a full sentence and returns the sorted words."""    
    words = break_words(sentence)    
    return sort_words(words)       

def print_first_and_last(sentence):    
    """Prints the first and last words of the sentence."""    
    words = break_words(sentence)    
    print_first_word(words)`

I saved this from gedit as

ex25.py

under the path

C:\Users\Brandon\Experiment\Python_ex

I am running 64-bit Windows 7.

When I go to import ex25 from python.exe
I get:

> Traceback (most recent call last):
>  File "(stdin)", line 1, in `<module>`
> ImportError: No module named ex25

Under Computer\Properties\Advanced\Environment Variables I added the System Variable:

PYTHONPATH

C:\Python27

That didn’t help.
What am I doing wrong?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T04:02:19+00:00Added an answer on May 24, 2026 at 4:02 am

    C:\Users\Brandon\Experiment\Python_ex is not on your system path, thus python is not aware where your ex25 module can be found

    import sys
    sys.path.append(r'C:\Users\Brandon\Experiment\Python_ex')
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm new to programming and thought Python would be a good language to learn.
I'm pretty new to Python programming and would appreciate some help to a problem
I am new to programming and am learning Python as my first language. I
Ok guys, I'm really new at python (and programming itself) so sorry for my
I'm relatively new to Python and am having problems programming with Scapy, the Python
I'm new to Python and am starting to teach myself GUI programming (hopefully) using
I always believed that when starting to learn a new programming language programmer must
I'm very new to Python and multithreaded programming in general. Basically, I have a
Im new to python programming.Im writing a simple command line based twitter app,and i
I'm new to Python and programming in general (a couple of weeks at most).

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.