Sovi.AI - AI Math Tutor

Scan to solve math questions

QUESTION IMAGE

jump to level 1 first, read strings fav_flower and least_fav_flower fro…

Question

jump to level 1
first, read strings fav_flower and least_fav_flower from input and assume fav_flower is always longer than least_fav_flower. then, output the following, all separated by spaces:

  • the value of least_fav_flower
  • \has\
  • the length of fav_flower minus the length of least_fav_flower
  • \less character(s) than\
  • the value of fav_flower

click here for example
note: print(a, b, c) outputs variables a, b, and c separated by spaces in one line.
1
2 \\\ your code goes here \\\|

Explanation:

Step1: Read input strings

fav_flower, least_fav_flower = input().split()

Step2: Calculate length difference

length_diff = len(fav_flower) - len(least_fav_flower)

Step3: Print required output

print(least_fav_flower, "has", length_diff, "less character(s) than", fav_flower)

Answer:

fav_flower, least_fav_flower = input().split()
length_diff = len(fav_flower) - len(least_fav_flower)
print(least_fav_flower, "has", length_diff, "less character(s) than", fav_flower)
Example Test Case:

If input is tulip rose, the output will be:
rose has 2 less character(s) than tulip