def emotify(string): a=string.split() l=len(a) for i in range(0,l): if(a[i]=="smile"): a[i]=":)" if(a[i]=="grin"): a[i]=":D" if(a[i]=="sad"): a[i]=":((" if(a[i]=="mad"): a[i]=">:("   print (*a)       string1=input("Enter the string:\n") emotify(string1);  please  explain this code. this is python

Microsoft Visual C#
7th Edition
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Joyce, Farrell.
Chapter14: Files And Streams
Section: Chapter Questions
Problem 17RQ
icon
Related questions
Question
100%

def emotify(string):

a=string.split()

l=len(a)

for i in range(0,l):

if(a[i]=="smile"):

a[i]=":)"

if(a[i]=="grin"):

a[i]=":D"

if(a[i]=="sad"):

a[i]=":(("

if(a[i]=="mad"):

a[i]=">:("

 

print (*a)

 

 

 


string1=input("Enter the string:\n")

emotify(string1); 
please  explain this code. this is python

Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT