How can you take input and transfer that into a function to obtain the result of a calculation? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How can you take input and transfer that into a function to obtain the result of a calculation?

For example: How do you get the age of an indivual through input and then subtract a predetemined amount from that to obtain a result? Do you require a function?

3rd Jun 2020, 12:06 PM
3.14
3.14 - avatar
2 Answers
+ 1
a=int(input()) func age(a): b=a-something return b print(age(a)) well function makes the code reusable anywhere ,you can achieve it without function as well a=int(input()) b=a-something Print(b)
3rd Jun 2020, 12:13 PM
Abhay
Abhay - avatar
- 2
Where is your try . We can help in your problems but dont think that we will provide you code. This is a self learning platform
3rd Jun 2020, 12:12 PM
Ayush Kumar
Ayush Kumar - avatar