Python Forum
Count Letters in a Sentence (without using the Count Function)
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Count Letters in a Sentence (without using the Count Function)
#2
to get each letter, use:
for letter in sentence:
    ...
remember that a string is a list or characters, so above will get a letter for each iteration.
Reply


Messages In This Thread
RE: Count Letters in a Sentence (without using the Count Function) - by Larz60+ - Jun-18-2018, 05:04 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Count occurences in a string and add to a list using loops Leyo 4 1,723 Mar-11-2022, 03:52 PM
Last Post: Leyo
  an array to count votes thechungusmaximus 2 1,541 Mar-09-2022, 03:44 PM
Last Post: DeaD_EyE
  Using regex to count specific character in file shamishd 1 1,657 Oct-01-2021, 07:33 AM
Last Post: snippsat
  Word count vanjoe198 1 1,988 Mar-16-2021, 12:27 AM
Last Post: BashBedlam
  Convert a sentence to pig latin SalsaBeanDip 4 3,242 Oct-04-2020, 01:45 AM
Last Post: SalsaBeanDip
  sys.stdin to do a word count based on user entry Kaltex 3 3,728 Jul-19-2020, 01:54 PM
Last Post: deanhystad
  Syllable Count Function pav1983 3 2,670 Jun-04-2020, 07:32 AM
Last Post: pyzyx3qwerty
  create a function that can count polk203 1 1,681 Apr-12-2020, 12:13 PM
Last Post: ibreeden
Exclamation A function that takes a word and a string of forbidden letters pooyan89 5 4,753 Jun-12-2019, 09:44 PM
Last Post: nilamo
  count unique letters in a word sunny_awesome 4 8,774 Jun-06-2019, 07:15 PM
Last Post: kotter

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020