Explanation

513.Print Multiple Lines

Easy
Given a name, an age and a city, return a three-line introduction card: "Name: …", "Age: …" and "City: …", one entry per line. On screen, "multiple lines" usually means several print calls, or one print with line breaks inside it. Both ideas appear here. The first solution builds a single string with \nEscape Sequence \nA backslash followed by n, typed as two characters but stored as one newline character that starts a new line when printed. line breaks and then cuts it apart; the second simply builds each line separately. Returning the lines as a list lets every line be checked on its own.

Example 1:

Input: name = "Asha", age = 19, city = "Pune"

Output: ["Name: Asha","Age: 19","City: Pune"]

Example 2:

Input: name = "Kiran", age = 7, city = "New Delhi"

Output: ["Name: Kiran","Age: 7","City: New Delhi"]

+ 3 hidden test cases run on Submit.

Constraints:

  • ●1 ≤ name.length, city.length ≤ 30
  • ●1 ≤ age ≤ 120
  • ●name and city contain letters and spaces only

name =

Asha

age =

19

city =

Pune