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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T11:23:35+00:00 2026-06-11T11:23:35+00:00

I have defined this function that takes a word and a string of required

  • 0

I have defined this function that takes a word and a string of required letters and that returns True if the word uses all the required letters at least once. When I run this, it gives me the correct output but I do not understand why it also outputs ‘None’.

Here is my code:

 def uses_all(word, allused):
    boolean = False
    for e in allused:
        if e in word:
            boolean = True
        else:
            boolean = False
            break 
    print boolean 

print uses_all('facebook', 'd')

Output:

False
None

Comments on where I have gone wrong will be appreciated.

  • 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-11T11:23:36+00:00Added an answer on June 11, 2026 at 11:23 am

    Your program prints boolean, which is False, so you know where that comes from.

    If a function doesn’t return anything explicitly, it automatically returns None, and when you use

    print uses_all('facebook', 'd')
    

    you’re asking it to print what uses_all returns, which is None. Hence:

    False
    None
    

    BTW, I think your function could be more concisely written as

    def uses_all(word, allused):
        return all(e in word for e in allused)
    

    Could make it more efficient, but that should be good enough for government work. The all function is really handy (see also any).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a function that takes the input of a user defined string and
I have a function that takes the input of a user defined string and
In c++ if I have a function that takes a class I have defined
Suppose I have a function f that takes a vector v and returns a
I have this self-defined function in my .bashrc : function ord() { printf '%d'
I have this user defined function. public partial class UserDefinedFunctions { static int i;
I have a function defined like this: public static void ShowAbout(Point location, bool stripSystemAssemblies
Suppose I have a function defined like this: class Foo() { public: void bar(MyClass*
I have an inline member function defined under class MyClass int MyClass::myInlineFunction(); This function
I have Javascript function defined in the main index.html file. One part of this

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.