Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Write a piece of code in Python and run it to get the desired output Comments are required (a) Create a string variable s such
Write a piece of code in Python and run it to get the desired output Comments are required (a) Create a string variable s such that the following works: You may need to use one or more special characters. print(s) Julia : I want an apple. Ginny : I like bananas. Charlotte : I think we'll take both. Both have high nutritional value. Your code here: Next, write Python commands which use s to print the specified outputs. Feel free to use loops and comprehensions; however, keep your code as concise as possible. Each solution should require at most three short lines of code. you should minimize the use of positional indexing (e.g. s[5:10]) when possible. (b) Output: Julia I want an apple. Ginny I like bananas. Charlotte I think we'll take both. Both have high nutritional value. Your code here: (c) Output: Julia Ginny Charlotte Hint: look at the endings of words. A small amount of positional indexing might be handy here. Your code here: (d) Output: Julia : I want an apple. Ginny : I like bananas. Hint: These two lines are shorter than the other one. Your code here: (e) Output (note the lack of quotation marks). Julia : I want an apple. Ginny : I like bananas. Charlotte : I think we'll take both. Both have high nutritional value. Hint: str. replace. Your code here
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