Python Forum
look at first letter in list and append word for assertion
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
look at first letter in list and append word for assertion
#1
Hi,

I have a list of names, such as: words=['cat', dog', 'lion','snake', 'fox']

I then want to write a function that looks at the words that start with c and s and validate that through an assertion as follow:

def get_words_that_start_with(letter): 
    
            return 

assertion('8a', get_words_that_start_with('c'), ['cat'])
assertion('8b', get_words_that_start_with('s'), ['snake'])
when I run my assertion, i should get correct because my function would recognize the word that start with c and s
Reply


Messages In This Thread
look at first letter in list and append word for assertion - by mapypy - Feb-06-2021, 03:41 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Find first letter from a list DariusCG 3 2,589 Nov-27-2019, 11:08 PM
Last Post: ichabod801
  have homework to add a list to a list using append. celtickodiak 2 2,073 Oct-11-2019, 12:35 PM
Last Post: ibreeden
  getting a word from a list sheck33332 2 2,593 May-07-2019, 05:17 PM
Last Post: sheck33332

Forum Jump:

User Panel Messages

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