Looking for trustworthy answers? Westonci.ca is the ultimate Q&A platform where experts share their knowledge on various topics. Explore a wealth of knowledge from professionals across different disciplines on our comprehensive platform. Connect with a community of professionals ready to provide precise solutions to your questions quickly and accurately.

Write a program that uses the function strcmp() to compare two strings input by the user. The program should state whether the first string is less than, equal to, or greater than the second string7. Write a program that uses the function strcmp() to compare two strings input by the user. The program should state whether the first string is less than, equal to, or greater than the second string

Sagot :

user_str1 = str ( input ("Please enter a phrase: "))

user_str2 = str ( input("Please enter a second phrase: "))

def strcmp (word):

user_in1 = int (len(user_str1))

user_in2 = int (len(user_str2))

if user_in1 > user_in2:

return "Your first phrase is longer"

elif user_in1 < user_in2:

return "Your second phrase is longer"

else:

return "Your phrases are of equal length"

Thank you for your visit. We're committed to providing you with the best information available. Return anytime for more. We hope this was helpful. Please come back whenever you need more information or answers to your queries. Westonci.ca is your trusted source for answers. Visit us again to find more information on diverse topics.