Function and String Mixed-Up Code QuestionsΒΆ

Create a function joinStrings(str1, str2) that takes two different strings as parameters, str1 and str2, and returns them as one string with str1 before str2. For example, joinStrings('he','llo') returns hello.

Write a function joinStrings(str1, str2) that takes two different strings as parameters, str1 and str2, and returns them as one string with str1 before str2. For example, joinStrings('he','llo') returns hello.

Create a function rect_per(w, h) that takes the width, w, and the height, h, as parameters. Calculate the perimeter, which is the width plus the height times two, and return a string in the form - Perimeter of rectangle with width of (w) and height of (h) is (perimeter). For example, rect_per(5,10) returns Perimeter of rectangle with width of 5 and height of 10 is 30.

Write a function rect_per(w, h) that takes the width, w, and the height, h, as parameters. Calculate the perimeter, which is the width plus the height times two, and return a string in the form - Perimeter of rectangle with width of (w) and height of (h) is (perimeter). For example, rect_per(5,10) returns Perimeter of rectangle with width of 5 and height of 10 is 30.

Create a function cube(n) that takes a number, n, and cubes it and returns a string in the form Cube of (n) is (n cubed). For example, cube(4) returns Cube of 4 is 64.

Write a function cube(n) that takes a number, n, and cubes it and returns a string in the form Cube of (n) is (n cubed). For example, cube(4) returns Cube of 4 is 64.

Create a function atlas(c_name) that takes a country name, c_name, as a parameter and returns a string in the form of The last letter of (c_name) is (last). For example, atlas('Germany') returns The last letter of Germany is y.

Write a function atlas(c_name) that takes a country name, c_name, as a parameter and returns a string in the form of The last letter of (c_name) is (last). For example, atlas('Germany') returns The last letter of Germany is y.

Create a function dateYear(date) that takes a string, date, in the format MM/DD/YYYY and returns the year. For example, dateYear(11/07/2000) should return 2000.

Write a function dateYear(date) that takes a string, date, in the format MM/DD/YYYY and returns the year. For example, dateYear(11/07/2000) should return 2000.

Create a function capitalize(str), that takes a string, str, and returns the string with the first letter capitalized. For example, capitalize('america') would return America.

Write a function capitalize(str), that takes a string, str, and returns the string with the first letter capitalized. For example, capitalize('america') would return America.

Create a function mod_password(password), that takes a string, password, and returns a new string that replaces all 's' in the string with '$'. For example, mod_password('suspense') returns $u$pen$e.

Write a function mod_password(password), that takes a string, password, and returns a new string that replaces all 's' in the string with '$'. For example, mod_password('suspense') returns $u$pen$e.

Create a function first_last(str), that takes a string, str, and returns a new string with the first two characters of the word followed by the last two characters. Assume str is four characters or more. For example, first_last('wander') returns waer.

Write a function first_last(str), that takes a string, str, and returns a new string with the first two characters of the word followed by the last two characters. Assume str is four characters or more. For example, first_last('wander') returns waer.

You have attempted of activities on this page