S

@sharathesunshine

Function Calculator

Python
7 hours ago
def add(a,b): return a + b def subtract(a,b): return a - b def multiply(a,b): return a * b def divide(a,b): return a // b print("\t\t\tFUNCTION CALCULATOR") print("1.Add\n2.Subtract\n3.Multiply\n4.Divide")

Maths Module

Python
1 week ago
import math print("The Floor and Ceiling Value of 23.56 are :" + str(math.ceil(23.56)) +"," + str(math.floor(23.56))) x = 10 y = -15 print("The Value of x after copying the sign from y is:" + str(math.copysign(x,y))) print("The Absolute Value of -96 and 56 are:" + str(math.fabs(-96)) + "," + str(math.fabs(56))) print("The GCD of 24 and 56 :" + str(math.gcd(24,56)))

Rock Paper Scissors

Python
1 week ago
import random while True: user_action = input("Enter a choice (rock,paper,scissors):") possible_actions = ["rock","paper","scissors"] computer_action = random.choice(possible_actions) print("\n You chose", user_action,"computer chose",computer_action,"\n") if user_action == computer_action: print("Both players selected", user_action,"It's a tie!") elif user_action == "rock": if computer_action == "scissors":

Number Game

Python
1 week ago
import random playing = True number = str(random.randint(0,9)) print("I will generate a number from 0 to 9, and you have to guess the number one digit at a time!") print("The game ends when you get 1!") while playing: guess = input("Give me your best guess!") if number == guess : print("You win the game") print("The number was", number)

Bye Bye

Python
1 week ago
Valid = False while not Valid : try: n = int(input("Enter a Number:")) while n % 2 == 0: print("Bye Bye") Valid = True except ValueError: print("Inavalid Input!")

Multiple Exceptions

Python
1 week ago
try: num1 , num2 = eval(input("Enter Two Numbers, Separated by a comma : ")) result = num1/num2 print("The Result is:",result) except ZeroDivisionError: print("Division by zero is error !!") except SyntaxError: print("The Comma is Missing. Enter numbers separated by a comma like this- 1,2 !") except: print("Incorrect Input!")

Multiple Exceptions

Python
1 week ago
try: num1 , num2 = eval(input("Enter Two Numbers, Separated by a comma : ")) result = num1/num2 print("The Result is:",result) except ZeroDivisionError: print("Division by zero is error !!") except SyntaxError: print("The Comma is Missing. Enter numbers separated by a comma like this- 1,2 !") except: print("Incorrect Input!")

Value Error

Python
1 week ago
try: number = int(input("Enter a Number : ")) print("The Number Entered Is : " , number) except ValueError as ex: print("Exception : " , ex)

Continue

Python
2 weeks ago
var = 10 while var > 0 : var = var - 1 if var == 5 : continue print("\n Current Variable Value :", var) print("\n Good Bye!")

Continue

Python
2 weeks ago
var = 10 while var > 10 : var = var - 1 if var == 5 : continue print("\n Current Variable Value :", var) print("\n Good Bye!")

Pass

Python
2 weeks ago
for x in range(20): if x % 20 == 0: print("Twist!") elif x % 15 == 0: pass elif x % 5 == 0: print("Fizz!") elif x % 3 == 0: print("Buzz!") else:

Break

Python
2 weeks ago
a = input("Enter a word:\n") for i in a: if (i =='A'): print("A is found!") break else: print("A not found!")

Factorial

Python
2 weeks ago
def factorial(x): '''This is a Recursive Funtion to find the Factorial of integer''' if x==0 or x==1: return 1 else: return x*factorial(x-1) print(factorial.__doc__) print("The Factorial of 0:",factorial(0)) print("The Factorial of 1:",factorial(1)) print("The Factorial of 2:",factorial(2))

cube of a cube

Python
2 weeks ago
def factorial(x): '''This is a Recursive Funtion to find the Factorial of integer''' if x==0 or x==1: return 1 else: return x*factorial(x-1) print(factorial.__doc__) print("The Factorial of 0:",factorial(0)) print("The Factorial of 1:",factorial(1)) print("The Factorial of 2:",factorial(2))

cube of a cube

Python
2 weeks ago
def cube(number): return number*number*number def by_three(number): if number%3==0: return cube(number) else: return False print(by_three(9)) print(by_three(4))

Tip of Waiter

Python
2 weeks ago
def total_cal(bill_amount,tip_perc): total = bill_amount *(1+0.01*tip_perc) total = round(total,2) print("Please Pay $",total) total_cal(150,20)

Square Area and Perimeter

Python
3 weeks ago
side=int(input("enter the side length\n")) def square_perimeter(): return 4*side def square_area(): return side**2 print("The perimeter of Square is:",square_perimeter()) print("The Area of Square is:",square_area())

Calculator

Python
3 weeks ago
def add (P,Q): return P+Q def subtract(P,Q): return P-Q def multiply (P,Q): return P*Q def divide(p,Q): return P/Q print("Please select the operation") print("a.Add\nb.Subtract\nc.Multiply\nd.Divide")

Weather Condition

Python
3 weeks ago
def weather_condition(): print("The weather is pleasant in:",spring) print("The weather is the same in:",autumn) spring= "Autumn" autumn= spring weather_condition()

Well Wishes

Python
3 weeks ago
def well_wishes(): print("Hello\nHow are you?") well_wishes()