# Write a python function that accepts a string from user as argument and display the # total number of words. inn = input("enter the word") def co(e): x = len(e.split()) print ("total number of words = ",x) co(inn) نسخ
# Write a python function which calculates the factorial of a number. def fact2(): fa = 1 x = int(input("enter the number")) for i in range (1,x+1): fa = fa * i print (fa) fact2() نسخ
# Write a python function that takes two lists and prints True if they have at least one common member. def k(): li1 = [1,2,3,4,5] li2 = [6,7,1,9,22] for i in range (len(li1)): if li1[i] in li2 : print("True") k() نسخ
Comments
Post a Comment