Facebook
From light, 1 Year ago, written in Python.
This paste is a reply to out of ur legue from light yagami - go back
Embed
Viewing differences between out of ur legue and Re: out of ur legue
Write a recursive function to print the factorial for a given number.
def recur_factorial(n):
if n==1:
return
n
else:
return n*recur_factorial(n-1)
num=int(input("Enter Number"))
if num<0:
print("Enter valid number")
elif num==0:
print("factorial of 0 is 1")
else:
print("The factorial of",num,"is",recur_factorial(num))
Enter Number 5
The factorial of 5 is 120factorial of 5 is 120


a. Write a function that takes a character (i.e. a string of length 1) and returns True if it is a vowel,
False otherwise.
def isvowel(char):
all_vowel='aeiou'
return char in all_vowel
print(isvowel('a"))
print(isvowel('b'))



b. Define a function that computes the length of a given list or string
def len(s):
counter=0
for i in S:
counter+=1
return counter
s=input("enter string:")
print(len(s))


b. Define a function that computes the length of a given list or string
def len(s):
counter=0
for i in S:
counter+=1
return counter
s=input("enter string:")
print(len(s))

Replies to Re: out of ur legue rss

Title Name Language When
op out of ur legue light kira python 1 Year ago.