Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Weekly Task 3 Basic Python Programming Hello, I have attached a picture of a task I need to complete. I am having trouble understanding functions
Weekly Task 3 Basic Python Programming
Hello, I have attached a picture of a task I need to complete. I am having trouble understanding functions and would love some help.
WeeklyTask3 This task will have you write a number of functions. The following functions can be present in your program code in any order, but the last line of your program must be main) so that you are calling your main program to cause it to execute. main() This function prompts the user for three items Enter three sentences, one after the other . a string of potential start characters . a string of potential end characters Then call each of the following functions (in the order given), separately for each of the three sentences entered from the keyboard. printlfNumeric(line) This function will print the entire line if the first character on the line is a digit. See the sample run below for output details printlfComment(line) This function will print the entire line if the first character on the line is #. See the sample run below for output details printlfStarts (line, chars) This function will print the entire line if the first character on the line is any of the characters in the starts string. See the sample run below for output details printlfEnds(line, chars) This function will print the entire line if the last character on the line is any of the characters in the ends string. See the sample run below for output details printOdds(line) This function will print the characters in the odd index locations within the string (1,3,5,etc.). See the sample run below for output details The best way to approach a program like this is to write just one of the last five functions and the part of main up to where that function is called. Get that much of your program debugged and then proceed to add another function and the call to t in main. Continue until all functions are written and debugged. Here is a sample run. ne of sentence: Ma ttle Tamb Enter Enter second Tine of sentence: 4, 5, 6, Pick up sticks Enter third line of sentence : #The mad hatter was here Enter the "starts string": aA Enter the "ends string"? .! rst ry had a ary had a little lamb, Ends with any of: Mary had a ittle 1amb, s: ayhdaltl ab 5, 6, Pick up sticks ric: 4, 5, 6, Pick up sticks s: ,5 ,Pc psik The mad hatter was here Comment: #The mad hatter was here ds: Temdhte a ee
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started