From 232b0f39081a483087a23699f2e2aa851e850909 Mon Sep 17 00:00:00 2001 From: sidtiwari2712 Date: Sat, 2 Oct 2021 14:56:12 +0530 Subject: [PATCH 1/3] Create add two number --- add two number | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 add two number diff --git a/add two number b/add two number new file mode 100644 index 0000000..8fbba12 --- /dev/null +++ b/add two number @@ -0,0 +1,10 @@ +# This program adds two numbers + +num1 = 1.5 +num2 = 6.3 + +# Add two numbers +sum = num1 + num2 + +# Display the sum +print('The sum of {0} and {1} is {2}'.format(num1, num2, sum)) From 4f64e60d8ac313a70206d8acab5f07236b4722bc Mon Sep 17 00:00:00 2001 From: sidtiwari2712 Date: Sat, 2 Oct 2021 14:59:16 +0530 Subject: [PATCH 2/3] Create solve quadratic --- solve quadratic | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 solve quadratic diff --git a/solve quadratic b/solve quadratic new file mode 100644 index 0000000..9304927 --- /dev/null +++ b/solve quadratic @@ -0,0 +1,17 @@ +# Solve the quadratic equation ax**2 + bx + c = 0 + +# import complex math module +import cmath + +a = 1 +b = 5 +c = 6 + +# calculate the discriminant +d = (b**2) - (4*a*c) + +# find two solutions +sol1 = (-b-cmath.sqrt(d))/(2*a) +sol2 = (-b+cmath.sqrt(d))/(2*a) + +print('The solution are {0} and {1}'.format(sol1,sol2)) From 1b3f7d2a8399f95b6739dc88283bd4c45b5f1390 Mon Sep 17 00:00:00 2001 From: sidtiwari2712 Date: Sat, 2 Oct 2021 15:19:26 +0530 Subject: [PATCH 3/3] Create swap in python --- swap in python | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 swap in python diff --git a/swap in python b/swap in python new file mode 100644 index 0000000..22a78b5 --- /dev/null +++ b/swap in python @@ -0,0 +1,16 @@ +# Python program to swap two variables + +x = 5 +y = 10 + +# To take inputs from the user +#x = input('Enter value of x: ') +#y = input('Enter value of y: ') + +# create a temporary variable and swap the values +temp = x +x = y +y = temp + +print('The value of x after swapping: {}'.format(x)) +print('The value of y after swapping: {}'.format(y))