Write two functions, one called addit and one called mult. addit takes one number as an input and adds 5. mult takes one number | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
- 1

Write two functions, one called addit and one called mult. addit takes one number as an input and adds 5. mult takes one number

My attempt: https://code.sololearn.com/cVh1CeHsQZ1V/#py

21st May 2019, 9:10 AM
Habib Hasan Shakil
Habib Hasan Shakil - avatar
4 Answers
+ 2
Hello! Can you show us the attempt you have already made so we can help you? Please put your code into Code Playground so it's easy to read.
21st May 2019, 9:34 AM
Rincewind
Rincewind - avatar
21st May 2019, 4:15 PM
Habib Hasan Shakil
Habib Hasan Shakil - avatar
0
Your code is a little confused, so here is a bit of guidance: You only need to take input once - write both the functions first, have addit take one parameter (let's say x), then inside the addit function have it call mult and pass both the input and result (x, y) to it. You can put a print statement inside each function, then you just have to call addit with input as the parameter. Have another go and good luck!
23rd May 2019, 9:03 AM
Rincewind
Rincewind - avatar
0
Hope this will help you. #CODE def mult(x): return x*addit(x) def addit(x): return x+5 #Explanation the first function is giving result by multiplying what we got from the add function and the add function is adding 5 and returning to what your input will be
1st Jun 2020, 1:47 PM
Mishan Regmi
Mishan Regmi - avatar