F-string9 0201. Who ate the cookie? For this problem you must create a program that says who ate the last cookie. If the input is a string then "Zach" ate the cookie. If the input is a float or an int then "Monica" ate the cookie. If the input is anything else "the dog" ate the cookie. The way to return the statement is: "Who ate the last cookie? It was (name)!" Ex: Input = "hi" --> Output = "Who ate the last cookie? It was Zach! .. 2023. 2. 1. 0130. Grasshopper - Personalized Message Create a function that gives a personalized greeting. This function takes two parameters: name and owner. Use conditionals to return the proper message: case name equals owner : 'Hello boss' otherwise : 'Hello guest' Solution: def greet(name: str, owner: str) -> str: return f"Hello {name == owner and 'boss' or 'guest'}" 2023. 1. 31. 1102. Welcome to the City Create a method sayHello/say_hello/SayHello that takes as input a name, city, and state to welcome a person. Note that name will be an array consisting of one or more values that should be joined together with one space between each, and the length of the name array in test cases will vary. Example: say_hello(['John', 'Smith'], 'Phoenix', 'Arizona') This example will return the string Hello, Joh.. 2022. 11. 2. 1024. Sum The Strings Create a function that takes 2 integers in form of a string as an input, and outputs the sum (also as a string): Example: (Input1, Input2 -->Output) "4", "5" --> "9" "34", "5" --> "39" "", "" --> "0" "2", "" --> "2" "-5", "3" --> "-2" Notes: If either input is an empty string, consider it as zero. Inputs and the expected output will never exceed the signed 32-bit integer limit (2^31 - 1) Solutio.. 2022. 10. 24. 1021. USD => CNY Create a function that converts US dollars (USD) to Chinese Yuan (CNY) . The input is the amount of USD as an integer, and the output should be a string that states the amount of Yuan followed by 'Chinese Yuan' Examples (Input -> Output) 15 -> '101.25 Chinese Yuan' 465 -> '3138.75 Chinese Yuan' The conversion rate you should use is 6.75 CNY for every 1 USD. All numbers should be represented as a.. 2022. 10. 21. Sum of numbers from 0 to N Description: We want to generate a function that computes the series starting from 0 and ending until the given number. Example: Input: > 6 Output: 0+1+2+3+4+5+6 = 21 Input: > -15 Output: -15 0 Output: 0=0 Solution: 1. If n is 0, "0=0" is returned. 2. If n is negative, "n 2022. 5. 11. 이전 1 2 다음