Nov-27-2019, 03:28 PM
two things
1. for consistency and for compliance with recommendations in PEP8, rename
2. instead of using
1. for consistency and for compliance with recommendations in PEP8, rename
checkInput
to check_input
. All other functions are lowercase (as recommended by PEP8)2. instead of using
i
as counter, you can use enumerate()
function:def check_input(txt, vocab): if txt == "list": print("let see baby's word list grow:") for i, word in enumerate(vocab, start=1): print(f"{i}\t{word}") elif any(s in txt for s in vocab): print(random.choice(vocab)) else: print("i've learned a new thing to say! thank you!")
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs