Facebook
From snonyamout#######, 6 Months ago, written in Python.
This paste is a reply to Re: Re: Re: first from shubh - view diff
Embed
Download Paste or View Raw
Hits: 235
  1. FIBONACCI SERIES
  2. n=int(input("enter the numger"))
  3. n1,n2=0,1
  4. count=0
  5. if n<=0:
  6.     print("please enter the positive number")
  7. elif n==1:
  8.     print(n1)
  9. else:
  10.     print("the fibonacci seroes is")
  11.     while count<n:
  12.         print(n1)
  13.         nth=n1+n2
  14.         n1=n2
  15.         n2=nth
  16.         count += 1
  17.  
  18. PRACTICAL 3A
  19. import string
  20. alphabet=set(string.ascii_lowercase)
  21. def ispangram(str):
  22.     return not set (alphabet)-set (str)
  23. string='the quick brown fox jumps over the lazy dog'
  24. if (ispangram (string) ==True):
  25.     print("It is a pangram")
  26. else:
  27.     print("It is not pangram")
  28.  
  29. ARMSTRONG AND PALINGDROM
  30. def armstrong(n):
  31.     return n
  32. n=int(input("Enter number"))
  33. Sum=0
  34. temp=n
  35. while temp>0:
  36.     digit=temp
  37.     Sum+ digit**3
  38.     temp//=10
  39. if n==sum:
  40.     print(n, "Is armstrong")
  41. else:
  42.     print(n," Is not armstrong")
  43. def palindrome(num):
  44.     return num
  45. num=int(input("Enter number"))
  46. temp=num
  47. rev=0
  48. while num>0:
  49.     dig=num
  50.     rev=rev*10+dig
  51.     num//=10
  52. if temp==rev:
  53.     print("Is palindrome")
  54. else:
  55.     print("Is not palindrome")
  56.  
  57.     xxx
  58.