Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

How to use a function output as an input of another function in Python

#Method 1: using return value inside another function

def fun1(a):
    res = a + 1
    return res


def fun2(c):
    res = c * 2
    return res


output = fun1(fun2(1))
print(output)



#Method 2: directly calling one function in the other

def function_1(n):
    v = n * n
    num = function_2(v)
    return num


def function_2(a_number):
    a_number = a_number * 2
    return a_number


print(function_1(10))

Comment

PREVIOUS NEXT
Code Example
Python :: critical errors python 
Python :: how to prefix numbers with zero in python 
Python :: pandas to_csv overwrite check 
Python :: python cheat sheets 
Python :: auto indent python code 
Python :: python lambda append to list and return it 
Python :: python import a filename given as string 
Python :: example of transformer 
Python :: TypeError: strptime() argument 1 must be str, not list 
Python :: 1045 - Triangle Types 
Python :: Custom x, y-ticks using ax 
Python :: Python 0 evaluates to False 
Python :: python setup specify c++ version 
Python :: python detect ranges in list 
Python :: odoo.py odoo 14 
Python :: poision in chinese 
Python :: how to get a rectangular grid out of two given one-dimensional arrays 
Python :: python generator cheat sheet download 
Python :: gui apps 
Python :: Console code page (437) differs from Windows code page (1252) 8-bit characters might not work correctly 
Python :: print less than specific number in one row python 
Python :: python sort by value first then key lexicography 
Python :: flask-restx custom ui 
Python :: emacs shift region left python 
Python :: pyqt5 how to see if clipboard is empty 
Python :: use reshape in python with zeros 
Python :: using list comprehension to filter out age group pandas 
Python :: add input to list python 
Python :: banner grabber api 
Python :: adding bootstrap grid dynamically django 
ADD CONTENT
Topic
Content
Source link
Name
2+7 =