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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T15:52:04+00:00 2026-06-13T15:52:04+00:00

I am new to python and coding in general and I need help with

  • 0

I am new to python and coding in general and I need help with this problem.

Write a program that will take a string as input and will perform the following functions:

▪ Print the number(count) of spaces in the string

▪ Print the number(count) of lower case letters

▪ Print number of punctuation marks

Demonstrate how you would find the last space in a string

Thanks

  • 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-13T15:52:05+00:00Added an answer on June 13, 2026 at 3:52 pm

    You can use filter and len together for counting things. For example:

    >>> import string
    >>> s="This char -- or that one -- It's a Space."
    >>> for k in [string.uppercase, string.lowercase, string.whitespace, string.punctuation]:
    ...     len(filter(lambda x: x in k, s))
    ... 
    3
    23
    9
    6
    

    Note, the string.uppercase, string.lowercase, etc. values are defined in the string module, and can be used after you import the string module. Each of them is a string value; for example:

    >>> string.whitespace
    '\t\n\x0b\x0c\r '
    >>> string.punctuation
    '!"#$%&\'()*+,-./:;<=>?@[\\]^_`{|}~'
    

    Note, in the above, >>> is the primary prompt from the python interpreter, and … is a secondary prompt for an indented line.

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

Sidebar

Related Questions

I am new to coding python. I am hoping to modify this code to
I am new to python and coding in general. I am trying to read
I'm new to Python (and coding in general) and I'm working my way through
I'm fairly new to python. I have an error that I need to understand.
I really new to Python and coding in general, but I have been making
I am new to python (well to coding in general) and am trying to
Keep in mind that I am still very new to python coding as I
I am new to Python (coming from MATLAB) and was beginning to learn that
Very new to python and can't understand why this isn't working. I have a
I am new to django and python in general, so pardon me for any

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.