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 917521
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T18:13:31+00:00 2026-05-15T18:13:31+00:00

I’m having a problem in calling a function that returns a result, from another

  • 0

I’m having a problem in calling a function that returns a result, from another function

To make it clear, my functions are:

def calculate_questions_vote(request):
    useranswer = Answer.objects.filter (answer_by = request.user)
    positive_votes = VoteUpAnswer.objects.filter(answer = useranswer)
    negative_votes = VoteDownAnswer.objects.filter(answer = useranswer)
    question_vote_rank = sum(positive_votes) - sum(negative_votes.count)
        return question_vote_rank

def calculate_replies(request):
    the_new = News.objects.filter(created_by = request.user)
    reply = Reply.objects.filter(reply_to = the_new)
    reply_rank = sum(reply)
        return reply_rank

and I want to call them in another function, so that it could return a value.
I’m calling the function form another function like this:

rank = calculate_questions_vote

Let’s say I just want for now to display the value returned by the function calculate_questions_vote.
Of course, I’m putting the rank variable in the context of the function.

My problem is that my output is:

<function calculate_questions_vote at 0x9420144>

How can I actually make it display the value returned by the function, instead of that string?

  • 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-15T18:13:31+00:00Added an answer on May 15, 2026 at 6:13 pm

    This is basic Python. What you are doing is simply referring to the function – assigning the function itself to another variable. To actually call a function, you need to use parenthesis after its name:

    calculate_questions_vote()
    

    In your case, you’ve defined that function as needing the request object, so you need to use that in the call as well:

    calculate_questions_vote(request)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I am currently running into a problem where an element is coming back from
I need a function that will clean a strings' special characters. I do NOT
I have a view passing on information from a database: def serve_article(request, id): served_article
That's pretty much it. I'm using Nokogiri to scrape a web page what has
For some reason, after submitting a string like this Jack’s Spindle from a text
I've got a string that has curly quotes in it. I'd like to replace
I have a French site that I want to parse, but am running into

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.