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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T12:59:28+00:00 2026-06-17T12:59:28+00:00

So basically, let’s say you define a function and then write something in ()

  • 0

So basically, let’s say you define a function and then write something in () brackets after then function. If I write function(gay), it ends up as ‘error name not defined’ Python2.73

def lenRecur(aStr):
    '''
    aStr: a string

    returns: int, the length of aStr
    '''
    print type(aStr)
    return

def lenRecur2(aStr):
    '''
    aStr: a string

    returns: int, the length of aStr
    '''
    s = str(aStr)
    print type(s)
    return

So when I type lenRecur(gay) or lenRecur2(gay), it ends up as an error whatever I do. So is there a way to avoid it? Without using “” quote marks.

  • 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-17T12:59:30+00:00Added an answer on June 17, 2026 at 12:59 pm

    No – unless your input is already a variable that holds a string (or another object).

    However, you could use a try-except block (but it won’t actually do anything if there’s an error).

    try:
        lenRecur(foo)
        lenRecur2(foo)
    except NameError:
        pass
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Basically in order to have a profile Block u need - let's say profile
Let's say I have a Type II SCD database, that is basically append only.
Basically I'm trying to set the SaveFileDialog's filter like let's say to... Xml Document
Basically let's say I'm making a simple counter, when I click the mouse, the
Let's say I have the following short-tag regex: \[BANNER{([0-9]*)}{(site1|site2)}{([A-Z]*)}\] basically, I have a CMS
i'm trying to let my android application function as a REST Client. Basically i
I'm not sure what to call this, but basically let's say I have a
Let's say I am using rendered as basically a case statement. I have a
Let's say I have two methods, one of which is basically a wrapper for
newbie on AS3 here! :) basically I'm trying to write an application that let

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.