Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Python (a) Write a function with function header def parse(s): that takes a stri

ID: 643974 • Letter: P

Question

Python (a) Write a function with function header def parse(s): that takes a string parameter s and returns a list containing all the words in s that are at least 4 letters long. The order in which words appear in the returned list does not matter. Also, it is okay for the list to contain multiple occurrences of the same word. Finally, it is required that all words appear in lower case implying that upper case letters need to be converted into corresponding lower case letters. For example, if the string s is "Lincoln

Explanation / Answer

Program for Python:

def parse(s):

Function with a header def parse(s):

Here the swapcase method makes all the uppercase letters to lowercase and viceversa.

#include<stdio.h>

#include "category.h"

main()

{

char ch;

int flag;

printf("character attributes");

printf("Upper case letters to be converted into lower case");

flag=scanf("%c",ch);

while(flag !=EOF) {

if(IS_LOWER(ch) ) print_category(LOWER,ch);

else if (IS_UPPER(ch)) print_category(UPPER,ch);

else if(IS_LOWER(ch)) print_category(LOWER,ch);

else if(IS_LINCOLN(ch)) print_category(LINCOLN,ch);

else if(IS_SILLY(ch)) print_category(SILLY,ch);

else if(IS_category(ch)) print_category(FLAT,ch);

else if(IS_category(ch)) print_category(DISHWATERY,ch);

else if(IS_category(ch)) print_category(UTTERANCES,ch);

else if(IS_category(ch)) print_category(CHICAGO,ch);

else if(IS_category(ch)) print_category(TIMES,(ch));

flag=scanf("%c",ch);

}

}