Answers for "how to use args in python?"

0

python get args

import sys

print(sys.argv)
Posted by: Guest on February-23-2021
0

args in python

# if args is not passed it return message
# "Hey you didn't pass the arguements"

def ech(nums,*args):
    if args:
        return [i ** nums for i in args]  # list comprehension
    else:
        return "Hey you didn't pass args"
    
print(ech(3,4,3,2,1))
Posted by: Guest on June-24-2021

Python Answers by Framework

Browse Popular Code Answers by Language