TEXT   63
hear2
Guest on 23rd November 2022 09:04:12 AM


  1. a=input("enter numbers with comma seperated:")
  2. b=a.split(",")
  3. if(b[0]==b[-1]):
  4.     print("true")
  5. else:
  6.     print("false")
  7.  
  8.  
  9. a=int(input("enter first number:"))
  10. b=int(input("enter second number:"))
  11. c=int(input("enter third number:"))
  12. if(a>b):
  13.     if(a>c):
  14.      print("%d is greater"%a)
  15. elif(c>b):
  16.  print("%d is greater"%c)
  17. else:
  18.  print("%d is greater"%b)
  19.        
  20.        
  21.  
  22.  
  23. a=int(input("enter the year:"))
  24. b=a%4
  25. if(b==0):
  26.     print("%d is a leap year"%a)
  27. else:
  28.   print("%d is not a leap year"%a)
  29.  
  30. a=int(input("enter a number:"))
  31. b=a%2
  32. if(b!=0):
  33.     print("%d is odd"%a)
  34. else:
  35.     print("%d is even"%a)
  36.  
  37.  
  38.  
  39. a=input("enter the character:")
  40. if(a=='a' or a=='A' or a=='e' or a=='E' or a=='i' or a=='I' or a=='o' or a=='O' or a=='u' or a=='U'):
  41.     print("%s is vowel"%a)
  42. else:
  43.     print("%s is not a vowel"%a)
  44.  
  45.  
  46.  
  47. print("Select the operation to perform:")
  48. print("1.Addition")
  49. print("2.Substract")
  50. print("3.Multiplication")
  51. print("4.Division")
  52. num1=float(input("Enter the 1st number:"))
  53. num2=float(input("Enter the 2nd number:"))
  54. choice=int(input("Enter the choice:"))
  55. if(choice==1):
  56.  print("Addition:%.2f" %(num1+num2))
  57. elif(choice==2):
  58.  print("Substract:%.2f" %(num1-num2))
  59. elif(choice==3):
  60.  print("Multiplication:%.2f" %(num1*num2))
  61. elif(choice==4):
  62.  print("Division:%.2f" %(num1/num2))
  63. else:
  64.  print("Invalid!")

Raw Paste

Login or Register to edit or fork this paste. It's free.