Mixed-up Code Questions¶
Create the function, mood(emotion)
, to return a string with the emotion
followed by " 4 you"
. For example, if emotion
is “So happy” it should
return "So happy 4 you!"
.
Write the function, mood(emotion)
, to return a string with the emotion
followed by " 4 you"
. For example, if emotion
is “So happy” it should
return "So happy 4 you!"
.
Create the function, item_purchase(item, price)
, to return a string with the item
purchased followed by the price
.
For example if item
is “new book” and price is 12
the function should return "My new book cost $12"
.
Write the function, item_purchase(item, price)
, to return a string with the item
purchased followed by the price
.
For example if item
is “new book” and price is 12
the function should return "My new book cost $12"
.
Create the function phrase(person, thing)
, to return a string with a person
of your choosing followed by a thing
of what that person likes to do. For example, if the person
is sam
and thing
is Likes to code
, the
returned string should be "Sam likes to code"
. Make sure that person
is capitalized and thing
is lowercase.
Write the function, phrase(person, thing)
, to return a string with a person
of your choosing followed by a thing
of what that person likes to do. For example, if the person
is Sam
and thing
is Likes to code
, the
returned string should be "Sam likes to code"
. Make sure that person
is capitalized and thing
is lowercase.
Let’s imagine that last weekend you went on a camping trip with your family. Create a function
time(hours, minutes)
. Return a string that says how long it took you to get home in minutes. For example,
if hours
was 3
and minutes
was 13
, the returned string should be, "It took us 193 minutes to get home"
.
Let’s imagine that last weekend you went on a camping trip with your family. Write a function
time(hours, minutes)
. Return a string that says how long it took you to get home in minutes. For example,
if hours
was 3
and minutes
was 13
, the returned string should be, "It took us 193 minutes to get home"
.
Create the function, food(fave, least_fave)
, to return a string with your fave
food followed by your least_fave
food both in lowercase.
For example, if your fave
food is “PIZZA” and your least_fave
is “broccoli”, return
"My favorite food is pizza, but I don't like broccoli"
. Be sure to change fave
and least_fave
to lowercase.
Write the function, food(fave, least_fave)
, to return a string with your fave
food followed by your least_fave
food both in lowercase.
For example, if your fave
food is “PIZZA” and your least_fave
is “broccoli”, return
"My favorite food is pizza, but I don't like broccoli"
. Be sure to change fave
and least_fave
to lowercase.
Create the function, animal(type)
, to return the string, “My type_animal
looks like a Muppet” with type
being
any animal of your choosing. For example, if your type
is “sheepdog”, then the returned string should
be "My sheepdog looks like a Muppet"
.
Finish the function, animal(type)
, to return the string, “My type_animal
looks like a Muppet” with type
being
any animal of your choosing. For example, if your type
is “sheepdog”, then the returned string should
be "My sheepdog looks like a Muppet"
.
Let’s imagine you went on a huge shopping spree. Create the function, total(store1, store2, store3)
,
to return the total of how much you spent at the three stores. For example, if you spent 30
in store1
, 13
in store2
, and 56
in store3
,
ans
return "$30 + $13 + $56 = $99"
.
Let’s imagine you went on a huge shopping spree. Write the function, total(store1, store2, store3)
,
to return the total of how much you spent at the three stores. For example, if you spent 30
in store1
, 13
in store2
, and 56
in store3
,
ans
return "$30 + $13 + $56 = $99"
.
Create the function combine(var1, var2)
, to return a string by combining the two variables var1
and var2
.
For example, if var1
is “i am a” and var2
is “CS wizard”, the function should return the string, "I am a cs wizard"
.
Make sure var1
is capitalized and var2
is lowercase.
Write the function, combine(var1, var2)
, to return a string by combining the two variables var1
and var2
.
For example, if var1
is “i am a “ and var2
is “CS wizard”, the function should return the string, "I am a cs wizard"
.
Create the function, colors(col1, col2)
, should return a string combining the variables col1
and col2
. For example,
if col1
and col2
is “‘red’” and “‘blue’”, then the function should return Red is a primary color and
so is blue
. Be sure to capitalize the first color and lowercase at second.
Write the function, colors(col1, col2)
, to return a string combining the variables col1
and col2
.
For example, if col1
and col2
is “‘Red’” and “‘blue’”, then the function should return Red is a primary color and
so is blue
. Be sure to capitalize the first color and lowercase the second.
Create the function, fave_animal(animal)
, to return the string, “Petting animal
makes me happier than anything else” where animal
is any animal of your choice. For example, if animal
is “dogs”, then the function should return, "Petting dogs makes
me happier than anything else"
.
Finish the function, fave_animal(animal)
, to return the string, “Petting animal
makes me happier than anything else” where animal
is any animal of your choice. For example, if animal
is “dogs”, then the function should return, "Petting dogs makes
me happier than anything else"
.