Skip to main content

Posts

Simple Calculator using Python

# Standard Calculator operator = input('Which operation do you wanna perform? \n +, -, * or /:  ') a = float(input('enter the number here:')) b = float(input('enter the number here:')) if operator == '+':     print(a, operator, b, '=', a+b) elif operator == '-':     print(a, operator, b, '=', a-b) elif operator == '*':     print(a, operator, b, '=', a*b) elif operator == '/':     print(a, operator, b, '=', a/b) else:     print('Invalid operation!') # Output : For Addition: Which operation do you wanna perform?   +, -, * or /:  + enter the number here:33 enter the number here:2.036 33.0 + 2.036 = 35.036 For Subtraction: Which operation do you wanna perform?   +, -, * or /:  - enter the number here:23 enter the number here:65656 23.0 - 65656.0 = -65633.0 For Multiplication: Which operation do you wanna perform?   +, -, * or /:  * enter the number here:1.009 enter the number here:23187 1.009 *

Login form using html/css

{html code} <html>     <head>         <link href='E:\html\.vscode\.vscode\style.css' type='text/css' rel='stylesheet'>         <title>Login Page</title>         <style>             a:hover{color: red;}             a:active{color: yellow;}         </style>     </head>     <body>         <div class='container'>             <div class="head"><h3>* Login form</h3></div>             <input class='id' placeholder="email or username" >             <br><br><br>             <input class='password' placeholder="password" type='password'>             <br><br><br><br>             <input class='button' type="submit" value="Submit">             <div class="text">                 <p><i>Forget Password!</i>        

Coloring Effect using html/css

{html code} <html>     <head>         <link href='E:\html\.vscode\.vscode\style.css' type='text/css' rel='stylesheet'>     <title>coloring effect</title>     </head>     <body>         <div class='text'>             <h2>coloring effect</h2>         </div>     </body> </html> {css code} body{     background: rgb(0, 0, 0); } .text{     position: absolute;     top: 20%;     left: 10%;     color: transparent;     background-image: linear-gradient(to right, rgb(0, 174, 255), rgb(98, 0, 128), rgba(255, 192, 203, 0.651), yellow );     font-family: 'poppins', sans-serif;     font-size: 60px;     text-transform: uppercase;     -webkit-background-clip: text;     animation: animate 5s linear infinite;     background-size: 400%;     -webkit-text-stroke-width: 0.6px;     -webkit-text-stroke-color: yellow;     text-align: center; } @keyframes animate{     0%{         background-posit

Glowing Border effect using html/css

  {html code} <html>     <head>         <link href='E:\html\.vscode\.vscode\style.css' type='text/css' rel='stylesheet'>         <title>Glowing Border</title>     </head>     <body>         <div class='box'>             <div class='text'>             <h2><u>Glowing Border</u></h2>             <p>HTML and CSS are technically not the programming languages, they are the scripting languages.              Usually used for the front-end development.</p>             </div>         </div>             </body> </html> {css code} body{     background: black;     display: flex; } .text{     padding: 30px;     margin: 10px;     letter-spacing: 1px;     box-sizing: border-box;     color: white; } .box{     top: 20%;     left: 40%;     display: flex;     position: relative;     width: 300px;     height: 420px;     justify-items: center;     align-it

Arithmetic Operators in python

>> Arithmetic operators + (Addition) - (Subtraction) * (Multiplication) / (Division) // (Floor Division) % (Modulus) ** (Exponent). >> Other operators are Comparison, Assignment and Logical which are most widely used. 1) Adding two variables:  a = 12 b = 231 add = a + b print('The addition is:', add) #Output: The addition is: 243 2) Subtracting two variables: a = 12 b = 231 subtract = b - a print('The subtraction is:', subtract) #Output: The subtraction is: 219 3) Multipling two variables: a = 12 b = 231 multiplication = a * b print('The multiplication is:', multiplication) #Output: The multiplication is: 2772 4) Dividing two variables: a = 12 b = 231 division = b/a print('The division is:', division) #Output: The division is: 19.25 5) Floor division: a = 12 b = 231 floor_division = b//a print('The floor division is:', floor_division) #Output: The floor division is: 19 6) Modulus: a = 12 b = 231 modulus = b % a print('The modulus

Implicit and Explicit Conversion in python

  #Lets take two variables a & b:- a = 14 print(type(a)) b = 14.66 print(type(b)) #Output: 14 has a datatype : <class 'int'> 14.66 has a datatype : <class 'float'> >>The output here shows what type of datatype variable 'a' and  'b' has. 'a' has integer datatype 'b' has float datatype  >> This type of conversion where python automatically converts one datatype into another is called as Implicit Conversion. >>Now lets take same variables for another type of conversion. a = 14 print(float(a)) As we all know that variable 'a' has an integer datatype but here we are explicitly converting that into float with the help of float(). #Output: 14.0 Here we can see that the output has a datatype float. b = 14.66 print(int(b)) Same goes here, in the above example we have seen that variable 'b' has a datatype float but here we are explicitly converting it into integer with the help of int(). #Output: 14

Array sorting in ascending and descending order using python.

  We need sorted() function to sort the given list in ascending or descending order. The syntax is as follows: sorted(list, key=..., reverse=....) >> Lets see first list sorting:-  #First we need to specify an array and save it in a variable. a = [2.2, 2.3233, 2322, 32.23, 2, 32.2, 5.11, 4, 0.1, 0.1] #Secondly we'll be using a sorted() function to sort out the given array. print('sorting in ascending order:', sorted(a)) #Lastly  we'll be using  reverse=True for the array to be in descending or der. print('sorting in descending order:', sorted(a, reverse = True)) #Output: sorting in ascending order: [0.1, 0.1, 2, 2.2, 2.3233, 4, 5.11, 32.2, 32.23, 2322] sorting in descending order: [2322, 32.23, 32.2, 5.11, 4, 2.3233, 2.2, 2, 0.1, 0.1] >> Then lets see set{} sorting:- a = {2.2, 2.3233, 2322, 32.23, 2, 32.2, 5.11, 4, 0.1, 0.1} #Output: [0.1, 0.1, 2, 2.2, 2.3233, 4, 5.11, 32.2, 32.23, 2322] >> Tuple() sorting:- a = (2.2, 2.3233, 2322, 32.23, 2,