Change the following code into a function that prints a crazy headline. It should take the values as parameters. Be sure

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899604
Joined: Mon Aug 02, 2021 8:13 am

Change the following code into a function that prints a crazy headline. It should take the values as parameters. Be sure

Post by answerhappygod »

Change the following code into a function that prints a crazy
headline. It should take the values as parameters. Be sure to call
the function to test it.
Change The Following Code Into A Function That Prints A Crazy Headline It Should Take The Values As Parameters Be Sure 1
Change The Following Code Into A Function That Prints A Crazy Headline It Should Take The Values As Parameters Be Sure 1 (23.39 KiB) Viewed 50 times
code:
input = "Elvis, alien, blue"
pieces = input.split(",")
name = pieces[0]
thing = pieces[1]
color = pieces[2]
headline = name + " was abducted by a " + color + " " + thing +
"."
print(headline)
Save & Run Load History 1 input = "Elvis, alien, blue" 2 pieces = input.split(",") 3 name = pieces[0] 4 thing pieces[1] 5 color = pieces[2] 6 headline = name + " was abducted by a " + color + 7 print (headline) 8 11 + 00
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply