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

  • SEARCH
  • Home
  • 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 7933331
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T21:17:59+00:00 2026-06-03T21:17:59+00:00

mod.py: def addone(number): result = number + 1 test.py: import mod print mod.addone(2) The

  • 0

mod.py:

def addone(number):
    result = number + 1

test.py:

import mod

print mod.addone(2)

The result I get is None, so I am guessing the result variable is missing. What is missing from my code.

And yes, I know this can easily be done without a module, it’s just an example.

  • 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-06-03T21:18:02+00:00Added an answer on June 3, 2026 at 9:18 pm

    You’re doing the import right, the method in mod.py that is not returning the result. Change to:

    def addone(number):
        return number + 1
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm having trouble with the following code: def get_module(mod_path): mod_list = mod_path.split('.') mod =
With the following code: class ObjA def func puts ObjA end end module Mod
I have a bit of ruby code: def createCal(cal) mod = @on + @off
Golang's math.Mod(10, 4) returns 2 -- ie. the integer part of division result 2.5
From: RewriteBase Apache Docs # /abc/def/.htaccess -- per-dir config file for directory /abc/def #
C-number is an integer n > 1 such that (b^n)mod n = b for
I have a python module that defines a number of classes: class A(object): def
I'm trying to get some rewriterules working. Htaccess is enabled, the mod-rewrite loads. It
I had to comment out the line below (example is from http://en.wikibooks.org/wiki/Clojure_Programming/Examples/Lazy_Fibonacci ) (def
I have some mod rewrite which will remove the .php and format a certain

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.