Answered step by step
Verified Expert Solution
Question
1 Approved Answer
- Q1: Write an addition function! Fill in the function body of addition_function that takes in two numbers and returns their sum. def addition_function(x,y): #
- Q1: Write an addition function! Fill in the function body of addition_function that takes in two numbers and returns their sum. def addition_function(x,y): # your code here return # and here Q2: Write function that increases the length of a string by one character You can add any character you like to the string, just make sure the string that comes out of the function is one character longer than the input string [ ] def extend_string(s): # your code here return # and here - Q3: Write function that decreases a number by a variable decrement The function will take two parameters: num and decrement, and the result should be a number that is smaller than num by decrement. def decrement_number(num, decrement): # your code here return # and here Q4: Add (in the math sense) two numbers that are represented initially as strings The function will take two parameters: x and y (each will be a string representation of a number), and the result should be an int that is the sum of the two numbers. Hint: remember what operators work for what data types, and that you can convert data types to other data types [ ] def string_math(x, y): # your code here return # and here Q5: Add (in the string sense) two strings that are represented initially as numbers The function will take two parameters: x and y (each will be an int), and the result should be a string that is the concatentation of the two number strings. For example, if x is 2 and y is 5, num_concat(x,y) should produce "25" (the string concatenation of the numbers), not 7 (the sum of the numbers). Hint: remember what operators work for what data types, and that you can convert data types to other data types
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started