This is my all Code Written by me
HTML CODE
HTML BASIC CODE
<!DOCTYPE HTML>
<html>
<head><title> practice html </title></head>
<body bgcolor="black" >
<font size="4" color="red" face="palatino">
<img src="C:\Users\dell\OneDrive\Documents\New folder" width="400px"
alt="rupa" border="5px" title="sonu thakur"/>
<marquee bgcolor="green" width="10000px" height="100px" behavior="alternate" direction="up">
<marquee bgcolor="green" width="10000px" height="100px" behavior="alternate" direction="right">
<h1> three value of marquee ( scroll, slide, alternate)</h1>
</marquee>
</marquee>
<p align="justify"><big> Microsoft Corporation is an American multinational technology company with headquarters in Redmond, Washington. It develops, manufactures, licenses, supports, and sells computer software, consumer electronics, personal computers, and related services. Its best known software products are the Microsoft Windows line of operating systems, the Microsoft Office suite, and the Internet Explorer and Edge web browsers. Its flagship hardware products are the Xbox video game consoles and the Microsoft Surface lineup of touchscreen personal computers. Microsoft ranked No. 21 in the 2020 Fortune 500 rankings of the largest United States corporations by total revenue;[3] it was the world's largest software maker by revenue as of 2016.[4] It is considered one of the Big Five companies in the U.S. information technology industry, along with Google, Apple, Amazon, and Facebook.
Microsoft (the word being a portmanteau of "microcomputer software"[5]) was founded by Bill Gates and Paul Allen on April 4, 1975, to develop and sell BASIC interpreters for the Altair 8800. It rose to dominate the personal computer operating system market with MS-DOS in the mid-1980s, followed by Microsoft Windows. The company's 1986 initial public offering (IPO), and subsequent rise in its share price, created three billionaires and an estimated 12,000 millionaires among Microsoft employees. Since the 1990s, it has increasingly diversified from the operating system market and has made a number of corporate acquisitions, their largest being the acquisition of LinkedIn for $26.2 billion in December 2016,[6] followed by their acquisition of Skype Technologies for $8.5 billion in May 2011.[7]</big> <br>
<h2> <B><I><U>hello friend I can show you some webpages link to teach you in all coding language</U></I></B> </h2></p>
<small> google search this name ( w3school.com) </small> <br>not this<del> w3 school</del>
<ul type="circle" >
<li> science </li>
<ol type="i" start="5">
<li> physics</li>
<li> chemistry </li>
<li> biology </li>
</ol><li> commerce </li>
<ol type="A" start="7">
<li> sp</li>
<li> bk </li>
<li> maths </li></ol>
<li> Art </li>
</ul>
<ul type="square" >
<li> science </li>
<ol type="i" start="5">
<li> physics</li>
<li> chemistry </li>
<li> biology </li></ol>
<li> commerce </li>
<ol type="A" start="3">
<li> sp</li>
<li> bk </li>
<li> maths </li>
</ul>
<p> some basic formula like co<sup>2</sup>,h<sub>2</sub>o</body>, and more</p>
<table border="2" align="center" bgcolor="#ff9900" >
<tr>
<th colspan="6" bgcolor="#000000" style="color:#ffffff"> Time Table </th>
</tr>
<tr bgcolor="#000000" style="color:#ffffff">
<th> monday </th>
<th> tuesday </th>
<th> wednesday </th>
<th> thursday</th>
<th> friday </th>
<th> saturday </th>
</tr>
<tr style="color:#ffffff">
<td>English </td>
<td>English</td>
<td>English</td>
<td>English</td>
<td>English</td>
<td>English</td>
</tr>
<tr style="color:#ffffff">
<td>hindi</td>
<td>hindi</td>
<td>hindi</td>
<td>hindi</td>
<td>hindi</td>
<td>hindi</td>
</tr>
<tr style="color:#ffffff">
<td>marathi</td>
<td>marathi</td>
<td>marathi</td>
<td>marathi</td>
<td>marathi</td>
<td>marathi</td>
</tr>
<tr style="color:#ffffff">
<td>science</td>
<td>science</td>
<td>science</td>
<td>science</td>
<td>science</td>
<td>science</td>
</tr>
<tr bgcolor="#000000" style="color:#ffffff">
<th >R </th>
<th>E</th>
<th>C</th>
<th> E </th>
<th>S</th>
<th>S</th>
</tr>
<tr style="color:#ffffff">
<td>social study</td>
<td>maths</td>
<td>Drawing </td>
<td>maths</td>
<td>Drawing</td>
</tr>
<tr style="color:#ffffff">
<td>maths</td>
<td>Drawing</td>
<td>maths</td>
<td>Drawing</td>
<td>maths</td>
</tr>
<tr style="color:#ffffff" >
<td>Drawing</td>
<td>p.T</td>
<td>p.T</td>
<td>p.T</td>
<td>p.T</td>
</tr>
</table>
<form>
name:-<input type="text" name="t1"><br>
standard<br>
<input type="radio" name="123">11<sup>std</sup>
<input type="radio" name="123">12<sup>std</sup><br>
select the option
<select the option>
<option>mumbai </option>
<option>Delhi </option>
<option>nagpur</option>
<option>thane </option>
</form>
</html>
HTML 5
<doctype html>
<html>
<head>
<title> html 5 </title>
</head>
<body bgcolor="green">
Enter your Name:-<input type="text" name="nam" autocomplete="on"><br>
enter name of country:-<input type="text" disable>
color:- <input type="color" name="color1"><br>
Enter your birthdate:-<input type="date"><br>
Enter your url:-<input type="url"><br>
Enter the value joining:-<input type="month" name="month"><br>
Enter your number:-<input type="number" name="num" min="5" max="30"><br>
time:-<input type="time" name="tim"><br>
range:-<input type="range"><br>
week:-<input type="week"><br>
Enter your email:-<input type="email"><br>
Enter yourdatetime:-<input type="datetime-local"><br>
Enter your telephone:-<input type="tel" name="phone no" pattern="[0-9]{3}-[0-9]{10}><br>
<input type="text" name="country_code" pattern="[A-Z]{#}{3}" title="three later country code"><br>
Select your files:-<input type="file" name="files" multple><br>
search:-<input type="search" name="search"><br>
<input type="image" src="C:\Users\dell\OneDrive\Documents\tejas.jpeg" name="url" height="40" width="40">
<input type="submit">
<body>
</html>
PERIODIC TABLE
<!DOCTYPE html>
<html>
<head>
<title>Periodic Table</title>
</head>
<body text="black">
<table border="1" align="center" width="20%" cellspacing="0" cellpadding="10px" bgcolor="orange">
<thead bgcolor="cyan">
<tr>
<th colspan="5">Periodic Table</th>
</tr>
</thead>
<tbody align="center">
<tr>
<td bgcolor="red">H</td>
<td colspan="3" style="border:0"></td>
<td bgcolor="red">He</td>
</tr>
<tr>
<td bgcolor="yellow">Le</td>
<td bgcolor="yellow">Be</td>
<td style="border:0;"></td>
<td bgcolor="yellow">F</td>
<td bgcolor="yellow">Ne</td>
</tr>
<tr>
<td bgcolor="tan">B</td>
<td bgcolor="tan">C</td>
<td style="border:0;"></td>
<td bgcolor="tan">Na</td>
<td bgcolor="tan">Mg</td>
</tr>
<tr>
<td bgcolor="lavender">N</td>
<td bgcolor="lavender">O</td>
<td style="border:0;"></td>
<td bgcolor="lavender">K</td>
<td bgcolor="lavender">Ca</td>
</tr>
</tbody>
</table>
</body>
</html>
HTML WITH CSS CODE
EXTERNAL CSS
<!Doctype html>
<head>
<title> External css </title>
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
<h1 align="center"> hello world π how are you </h1>
<b> I AM CREATE A NEW WEB PAGES </b>
</body>
</html>
h1{color:green}
b{font-style:italic}
body{background-color:pink}
INLINE CSS
<!Doctype html>
<head>
<title> inline css </title>
</head>
<body style="background-color:yellow">
<b style="color:red; font-size:34pt;"> hello world π how are you </b>
</body>
</html>
INTERNAL CSS
<!Doctype html>
<head>
<title> internal css </title>
<style>
h1{border-style:dotted}
body{background-color:skyblue}
</style>
</head>
<body>
<h1 align="center"> hello world π how are you </h>
</body>
</html>
METATAG WITH CSS
<doctype html>
<html>
<head>
<meta name="Keywords" content="email,phone,date,max,min,url">
<meta name="description" content="copyright balbharti all right reserved">
<meta http-equiv="refresh" content="5" url=http;//www.google.com">
<link rel="stylesheet" type="text/css" href="Tejas.css"
</head>
<body>
<b>FORM FILL</b>
<form>
Name:-<input type="text" name="f1"><br>
email:-<input type="email" name="email" autocomplete="on"><br>
data of inception:-<input type-"date" name="joindate"><br>
office time =<input type><br>
no of year completed:-<input type="number" name="num" max="100" min="1"<br>
<br>office ph no:-<input type="tel" name="phone" pattern="[0-9] {2}-[0-9] {10}"><br>
add your homepages:-<input type="url" name="ur12"><br>
<input type="submit" name="submit">
</form>
</body>
</html>
body{background-color:yellow}
b{color:blue;font-size:35pt}
form{color:red;font-size:35pt}
submit{}
JAVASCRIPT CODE
JAVASCRIPT
<!DOCTYPE HTML>
<html>
<head> <title> my web pages </title>
<body bgcolor="green">
<h1>program to check no is even or odd</h1>
<script language="javascript">
var a,b
a=prompt("enter your value:-");
b=parseInt(a);
//input is converted into number data type
if(b%2==0)
alert("number is even");
else
alert("number is odd");
</script>
</body>
</html>
PHRAMACY
<html>
<head>
<title> pharmacy</title>
<link rel="stylesheet" type="text/css" href="css pharmacy.css">
<script type="text/javascript">
//this is only of work
</script>
</head>
<body bgcolor="black" text="white" >
<img src="C:\Users\dell\OneDrive\Documents\sonu.jpg" width="200px" height="300px" alignment="center" alt="Sonu" border="5" title="pharmacy" /> <br>
<h2><I><b>Sonu Amar Thakur </b></I></h2>
<h2><I><b>Thakur pharmacy company </b></I></h2>
<p> This side you get all type of medicine all type of Branded medicine and varities there so many link to get medicines and personal care</p>
<ol type="1">
<li>This link Click to get medicine <br>
ππππ<a href="https://www.phablecare.com">Medicine</a>
</li>
<li>This link Click to get Mask, Sanitizer and Disinfectant <br>
ππππ<a href="https://indiamart.com"> personal kid</a>
</li>
<li>This link Click to get treatement Cancer <br>
ππππ<a href="https://www.cancer.gov">cancer Treatement</a>
</li>
<li>This link click to get to Click image in prescription and take medicine <br>
ππππ<a href="https://thehindu.com">prescription</a>
</li>
</ol> <br><br>
Follow me <br> <br>
<img src="C:\Users\dell\OneDrive\Documents\sonu.jpg" alt="Sonu"> <br>
Follow me on facebook <br>
<img src="C:\Users\dell\OneDrive\Documents\sonu.jpg" alt="sonu"> <br>
Follow me no instagram <br>
<img src="C:\Users\dell\OneDrive\Documents\sonu.jpg" alt="sonu"> <br>
Follow me no Twitter <br>
<br> <br>
About
<p>When visitors go to your website, the first place they go is your landing page. If they have an interest past your landing page, they will probably go to your βAbout Usβ page to learn more.
When a website visitor decides to go to the βAbout Usβ page for your Pharmacy business, he or she is on a fact-finding mission, as well as looking for the βstoryβ of your Pharmacy business.
Itβs crucial that your βAbout Usβ page says what goods or services your Pharmacy business provides. </p>
<p>What to write in about us page for Pharmacy business? </p>
<p><ul type="circle"><li> Mention the establishment date and years of experience in the field of pharmacy </li>
<li>Mention the detail of every product that you offers</li>
<li>Tell your customers that why should they trust you </li>
<li> Mention the test or any check-ups your company offers </li>
<li> Reveal your business boundaries and physical relation of every shop </li>
<li> Make sure every contact detail should be there </li></ul></p>
</body>
http://css%20pharmacy.js
</html>
h2{color:aqua}
HTML,CSS and Javascript project
HTML CODE
<!DOCTYPE html>
<html Lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1,0">
<title>Sonu Thakur - Web Developer, Programmer, ML Enthusiast</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<div class="container">
<div class="sidebar sidebarGo">
<div class="newname">Sonu </div>
<nav>
<ul>
<li><a href="Home.html">Home</a></li>
<li><a href="intro.html">My Intro</a></li>
<li><a href="blog.html">Blog</a></li>
<li><a href="services.html">services</a></li>
<li><a href="contact.html">Contact me</a></li>
</ul>
</nav>
</div>
<div class="main">
<div class="hamburger">
<img class="ham" src="ham.png" alt="" width="23">
<img class="cross" src="cross.png" alt="" width="23">
</div>
<div class="infocontainer">
<div class="devInfo">
<div class="hello">Hello,my name is </div>
<div class="name">Sonu Thakur</div>
<div class="name"></div>
<div class="about">I'm a Web Developer</div>
<div class="Moreabout"> I'm a web Developer with extensive experience. My expertise is to
create website and design,website Develop, and many more...
</div>
<div class="button">
<a href="cv.txt">
<button class="btn"> View My CV</button></a>
<a href="contact.html"><button class="btn">Contact me</button></a>
</div>
</div>
<div class="devPic"><img src="photo 2.png" alt="Sonu">
</div>
</div>
</div>
<script src="script.js"></script>
</body>
</html>
intro
<!DOCTYPE html>
<html Lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1,0">
<title>Sonu Thakur - Web Developer, Programmer, ML Enthusiast</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<div class="container">
<div class="sidebar">
<div class="newname">Sonu </div>
<nav>
<ul>
<li><a href="Home.html">Home</a></li>
<li><a href="intro.html">My Intro</a></li>
<li><a href="blog.html">Blog</a></li>
<li><a href="services.html">services</a></li>
<li><a href="contact.html">Contact me</a></li>
</ul>
</nav>
</div>
<div class="main">
<div class="hamburger">
<img class="ham" src="ham.png" alt="" width="23">
<img class="cross" src="cross.png" alt="" width="23">
</div>
<div class="intro">
<h1>About me</h1>
<p>Sonu Thakur - Web Developer, Programmer, ML Enthusiast I am a Developer, and I love coffee, I live
in Maharashtra and I love to visit new delhi</p>
<h2> My Skills </h2>
<div class="skillcontainer">
<div class="skillItem">HTML:<div class="skill hundred"></div></div>
<div class="skillItem">CSS:<div class="skill fifty"></div></div>
<div class="skillItem">JavaScript:<div class="skill fifty"></div></div>
<div class="skillItem">Php:<div class="skill t5"></div></div>
<div class="skillItem">Python:<div class="skill seventy"></div></div>
</div>
</div>
</div>
<script src="script.js"></script>
</body>
</html>
blog
<!DOCTYPE html>
<html Lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1,0">
<title>Sonu Thakur - Web Developer, Programmer, ML Enthusiast</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<div class="container">
<div class="sidebar">
<div class="newname">Sonu </div>
<nav>
<ul>
<li><a href="Home.html">Home</a></li>
<li><a href="intro.html">My Intro</a></li>
<li><a href="blog.html">Blog</a></li>
<li><a href="services.html">services</a></li>
<li><a href="contact.html">Contact me</a></li>
</ul>
</nav>
</div>
<div class="main">
<div class="hamburger">
<img class="ham" src="ham.png" alt="" width="23">
<img class="cross" src="cross.png" alt="" width="23">
</div>
<div class="blogcontainer">
<h1> Blogs by Sonu - the legend</h1>
<div class="blogItem">
<h2> My HTML Code - in fun way! </h2>
<p> I am a Developer, and I love coffee, I live
in Maharashtra and I love to visit new delhi</p>
<button class="btn btn sm">Read More</button>
</div>
<div class="blogItem">
<h2> My CSS code - in fun way! </h2>
<p> I am a Developer, and I love coffee, I live
in Maharashtra and I love to visit new delhi</p>
<button class="btn btn sm">Read More</button>
</div>
<div class="blogItem">
<h2> My Javascript Code - in fun way! </h2>
<p> I am a Developer, and I love coffee, I live
in Maharashtra and I love to visit new delhi</p>
<button class="btn btn sm">Read More</button>
</div>
<div class="blogItem">
<h2> My Python Code - in fun way! </h2>
<p> I am a Developer, and I love coffee, I live
in Maharashtra and I love to visit new delhi</p>
<button class="btn btn sm">Read More</button>
</div>
</div>
</div>
</div>
<script src="script.js"></script>
</body>
</html>
contact
<!DOCTYPE html>
<html Lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1,0">
<title>Sonu Thakur - Web Developer, Programmer, ML Enthusiast</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<div class="container">
<div class="sidebar">
<div class="newname">Sonu </div>
<nav>
<ul>
<li><a href="Home.html">Home</a></li>
<li><a href="intro.html">My Intro</a></li>
<li><a href="blog.html">Blog</a></li>
<li><a href="services.html">services</a></li>
<li><a href="contact.html">Contact me</a></li>
</ul>
</nav>
</div>
<div class="main">
<div class="hamburger">
<img class="ham" src="ham.png" alt="" width="23">
<img class="cross" src="cross.png" alt="" width="23">
</div>
<div class="contactform">
<h1>Contact me for work/general equiries</h1>
<form>
<div class="mb-3">
<label for="clientmail" class="form-label">Name</label>
<input type="name" class="form-control" id="exampleInputEmail1" aria-describedby="emailHelp">
</div>
<div class="mb-3">
<label for="clientmail" class="form-label">Email address</label>
<input type="email" class="form-control" id="exampleInputEmail1" aria-describedby="emailHelp">
<div id="emailHelp" class="form-text">We'll never share your email and phone with anyone else.</div>
</div>
<div class="mb-3">
<label for="clientphone" class="form-label">Phone</label>
<input type="password" class="form-control" id="clientphone">
</div>
<div class="mb-3">
<label for="clientmail" class="form-label">Enquiry</label>
<input type="name" class="form-control" id="exampleInputEmail1" aria-describedby="emailHelp">
</div>
<div class="mb-3" id="form-check">
<input type="checkbox" class="form-check-input" id="isclient">
<label class="form-check-label" for="isclient">I want you to Work on your project with me</label>
</div>
<button type="submit" class="btn btn-sm">Submit</button>
</form>
</div>
</div>
</div>
<script src="script.js"></script>
</body>
</html>
service
<!DOCTYPE html>
<html Lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1,0">
<title>Sonu Thakur - Web Developer, Programmer, ML Enthusiast</title>
<link rel="stylesheet" href="style.css">
<link href="https://unpkg.com/tailwindcss@^2/dist/tailwind.min.css" rel="stylesheet">
</head>
<body>
<div class="container">
<div class="sidebar">
<div class="newname">Sonu </div>
<nav>
<ul>
<li><a href="Home.html">Home</a></li>
<li><a href="intro.html">My Intro</a></li>
<li><a href="blog.html">Blog</a></li>
<li><a href="services.html">services</a></li>
<li><a href="contact.html">Contact me</a></li>
</ul>
</nav>
</div>
<div class="main">
<div class="hamburger">
<img class="ham" src="ham.png" alt="" width="23">
<img class="cross" src="cross.png" alt="" width="23">
</div>
<script src="script.js"></script>
</body>
</html>
CSS CODE
@import url('https://fonts.googleapis.com/css2?family=Roboto+Slab&display=swap');
*{
margin: 0;
padding: 0;
}
.sidebar{
position: absolute;
background-color:rgb(43, 168, 245);
font-family: 'Fira sans', sans-serif;
height: 100vh;
transition: transform 0.3s ease-in;
}
.sidebar nav{
padding: 45px;
}
.sidebar nav li {
list-style: none;
font-size: 30px;
padding: 33px 0;
}
.sidebar nav li a{
text-decoration: none;
color:#080808;
}
.main{
background-color: rgb(3, 3, 55);
width :90vw;
}
.container{
display: flex;
}
.infocontainer{
background-color: #080808;
height:58vh;
width: 80vw;
margin: 144px auto;
display: flex;
justify-content: space-around;
}
.devInfo{
font-size: 13px;
color: #f4eded;
display: flex;
justify-content: center;
flex-direction: column;
font-family:Georgia, 'Times New Roman', Times, serif
}
.hello{
font-size: 3em;
}
.name{
font-size: 3em;
color: rgb(227, 32, 14);
font-weight: bold;
font-family:'Trebuchet MS', 'Lucida Sans Unicode', 'Lucida Grande', 'Lucida Sans', Arial, sans-serif
}
.about{
font-size: 28px;
}
.Moreabout{
font-size: 2em;
margin-top: 23px;
font-family: 'Fira sans', sans-serif;
}
.button{
margin-top: 2.2em;
font-size: 16px;
}
.btn {
padding: 9px 14px;
border-radius: 22px;
color: #ede8eb;
background-color: rgb(19, 124, 229);
font-weight: bold;
font-size: 2em;
margin: 3px 3px;
cursor: pointer;
}
.btn-sm{
font-size: 10px;
padding: 9px 14px;
margin: 10px 0;
}
.btn:hover{
background-color: #ede8eb;
color: rgb(13, 97, 223);
}
.devPic img{
height: 58vh;
}
.contactform{
padding: 0 34px;
color: #faf6fa;
font-family: 'Fira sans', sans-serif;
margin: 88px;
}
.contactform h1{
font-family: 'source code pro', monospace;
/*padding: 12px 0; */
}
.contactform form div{
padding: 10px 0;
display: flex;
flex-direction: column;
}
.contactform form div input{
/*width: 16vw;*/
border-radius: 5px;
margin: 6px 0 0 0;
padding: 3px;
}
.contactform form{
margin: 0 40px;
}
#emailHelp{
font-size: 12px;
color: rgb(250, 250, 250);
margin: 0 5px;
padding: 3px 0 0 0;
}
#form-check{
flex-direction: row;
}
#form-check input{
width: 24px;
margin: 3px 0;
}
.blogItem{
margin: 20px;
color: #ede8eb;
font-family: 'Fira sans', sans-serif;
}
.blogcontainer{
color: #ede8eb;
margin: 88px;
}
h1{
font-family: 'Fira sans', sans-serif;
margin: 23px;
}
p{
font-family: 'source code pro',monospace ;
}
.intro{
margin: 88px;
color: #ede8eb;
}
.intro h2{
font-family: 'Fira sans', sans-serif;
margin: 12px;
}
.intro p{
font-family: 'Fira sans', sans-serif;
margin: 12px;
}
.skillcontainer{
padding: 12px;
}
.skillItem{
display: flex;
align-items: center;
font-family: 'source code pro',monospace ;
font-weight: 900;
}
.skill{
width: 265px;
height: 6px;
background-color: red;
border: 2px solid black;
}
.hundred{
width: 265px;
background-color: blueviolet;
}
.fifty{
width: 200px;
background-color: blue;
}
.t5{
width: 75px;
background-color: aqua;
}
.seventy{
width: 190px;
background-color: red;
}
.sidebarGo{
transform:translate(-443px, 0px);
position: absolute;
}
.hamburger{
position: absolute;
cursor: pointer;
top: 10px;
left: 10px;
}
.ham{
margin-top: 10px;
}
.cross{
margin-left: 185px;
margin-top: 10px;
}
@media(max-width: 1000px){
*{
/*background-color:rgb(242, 156, 156);*/
}
.buttons{
font-size: 6px;
}
.devInfo{
font-size: 10px;
}
.devPic{
display: none;
}
.intro, .blogcontainer, .contactform{
margin: 50px 8px;
}
}
.newname{
color: #f62308;
font-size: 30px;
font-family:cursive
}
JAVASCRIPT
console.log("script running...")
document.querySelector('.cross').getElementsByClassName.display = 'none';
document.querySelector('.hamburger').addEventListener("click", ()=>{
document.querySelector('.sidebar').classList.toggle('sidebarGo');
if(document.querySelector('.sidebar').classList.contains('sidebarGo')){
document.querySelector('.ham').style.display = 'inline'
document.querySelector('.cross').style.display = 'none'
}
else{
document.querySelector('.ham').style.display = 'none'
setTimeout(() => {
document.querySelector('.cross').style.display = 'inline'
}, 350);
}
})
PATHON CODE
HELLO PYTHON
'''
Author: SONU
Licenced to: ABC Company
***********Thanks for reading**********
'''
import os # importing the os module
print("Hello world")
VARIABLE PYTHON
a_122 = '''SONU'''
# a = 'SONU'
# a = "SONU"
b = 345
c = 45.32
d = True
# d = None
# Printing the variables
print(a)
print(b)
print(c)
print(d)
# Printing the type of variables
print(type(a))
print(type(b))
print(type(c))
print(type(d))
OPERATOR PYTHON
a = 3
b = 4
# Arithmetic Operators
print("The value of 3+4 is ", 3+4)
print("The value of 3-4 is ", 3-4)
print("The value of 3*4 is ", 3*4)
print("The value of 3/4 is ", 3/4)
# Assignment Operators
a = 34
a -= 12
a *= 12
a /= 12
print(a)
# Comparison Operators
# b = (14<=7)
# b = (14>=7)
# b = (14<7)
# b = (14>7)
# b = (14==7)
b = (14!=7)
print(b)
# Logical Operators
bool1 = True
bool2 = False
print("The value of bool1 and bool2 is", (bool1 and bool2))
print("The value of bool1 or bool2 is", (bool1 or bool2))
print("The value of not bool2 is", (not bool2))
TYPECASTING PATHON
a = "35fgrfg34"
a = int(a)
print(type(a))
print(a + 5)
INPUT FUNCTION PATHON
a = input("Enter a number: ")
a = int(a) # Convert a to an Integer(if possible)
print(type(a))
1 ADD 2 IN PYTHON
a = 30
b = 15
print("The sum of a and b is", a + b)
AVERAGE NUMBER IN PYTHON
a = input("Enter first number: ")
b = input("Enter second number: ")
a = int(a)
b = int(b)
avg = (a + b)/2
print("The average of a and b is", avg)
STRING
# b = "Harry's" # --> Use this if you have single quotes in your strings
# b = 'Harry"s'
b = '''Harry"s and
Harry's'''
print(b)
# print(type(b))
STRING FUNTION
story = "once upon a time there was a youtuber named Harry who uploaded python course with notes Harry"
# String Functions
# print(len(story))
# print(story.endswith("notes"))
# print(story.count("c"))
# print(story.capitalize())
# print(story.find("upon"))
print(story.replace("Harry", "CodeWithHarry"))
INPUT
name = input("Enter your name\n")
print("Good Afternoon, " + name)
LETTER
letter = '''Dear <|NAME|>,
Greetings from ABC coding house. I am happy to tell you about your selection
You are selected!
Have a great day ahead!
Thanks and regards,
Bill
Date: <|DATE|>
'''
name = input("Enter Your Name\n")
date = input("Enter Date\n")
letter = letter.replace("<|NAME|>", name)
letter = letter.replace("<|DATE|>", date)
print(letter)
LIST
# Create a list using []
a = [1, 2 , 4, 56, 6]
# Print the list using print() function
print(a)
# Access using index using a[0], a[1], a[2]
print(a[2])
# Change the value of list using
a[0] = 98
print(a)
# We can create a list with items of different types
c = [45, "Harry", False, 6.9]
print(c)
List slicing
# List slicing
friends = ["Harry", "Tom", "Rohan", "Sam", "Divya", 45]
print(friends[0:4])
print(friends[-4:])
LIST METHOD
l1 = [1, 8, 7, 2, 21, 15]
print(l1)
# l1.sort() # sorts the list
# l1.reverse() # reverses the list
#l1.append(45) # adds 45 at the end of the list
# l1.insert(2, 544) # inserts 544 at index 2
# l1.pop(2) # removes element at index 2
l1.remove(21) # removes 21 from the list
print(l1)
TUPLES
# Creating a tuple using ()
t = (1, 2, 4, 5)
# t1 = () # Empty tuple
# t1 = (1) # Wrong way to declare a Tuple with Single element
t1 = (1,) # Tuple with Single element
print(t1)
# Printing the elements of a tuple
# print(t[0])
# Cannot update the values of a tuple
# t[0] = 34 # throws an error
TUPLES METHOD
# Creating a tuple using ()
t = (1, 2, 4, 5, 4, 1, 2,1 ,1)
print(t.count(1))
print(t.index(5))
STORE METHOD
f1 = input("Enter Fruit Number 1: ")
f2 = input("Enter Fruit Number 2: ")
f3 = input("Enter Fruit Number 3: ")
f4 = input("Enter Fruit Number 4: ")
f5 = input("Enter Fruit Number 5: ")
f6 = input("Enter Fruit Number 6: ")
f7 = input("Enter Fruit Number 7: ")
myFruitList = [f1, f2, f3, f4, f5, f6, f7]
print(myFruitList)
STORE METHOD MARK
m1 = int(input("Enter Marks for Student Number 1: "))
m2 = int(input("Enter Marks for Student Number 2: "))
m3 = int(input("Enter Marks for Student Number 3: "))
m4 = int(input("Enter Marks for Student Number 4: "))
m5 = int(input("Enter Marks for Student Number 5: "))
m6 = int(input("Enter Marks for Student Number 6: "))
myList = [m1, m2, m3, m4, m5, m6]
myList.sort()
print(myList)
ADDING METHOD
a = [2, 4, 56, 7]
print(a[0] + a[1] + a[2] + a[3])
print(sum(a))
DICTIONARY
myDict = {
"Fast": "In a Quick Manner",
"Harry": "A Coder",
"Marks": [1, 2, 5],
"anotherdict": {'harry': 'Player'}
}
# print(myDict['Fast'])
# print(myDict['Harry'])
myDict['Marks'] = [45, 78]
print(myDict['Marks'])
print(myDict['anotherdict']['harry'])
DICTIONARY
myDict = {
"fast": "In a Quick Manner",
"harry": "A Coder",
"marks": [1, 2, 5],
"anotherdict": {'harry': 'Player'},
1: 2
}
# Dictionary Methods
print(list(myDict.keys())) # Prints the keys of the dictionary
print(myDict.values()) # Prints the keys of the dictionary
print(myDict.items()) # Prints the (key, value) for all contents of the dictionary
print(myDict)
updateDict = {
"Lovish": "Friend",
"Divya": "Friend",
"Shubham": "Friend",
"harry": "A Dancer"
}
myDict.update(updateDict) # Updates the dictionary by adding key-value pairs from updateDict
print(myDict)
print(myDict.get("harry")) # Prints value associated with key "harry"
print(myDict["harry"]) # Prints value associated with key "harry"
# The difference between .get and [] sytax in Dictionaries?
print(myDict.get("harry2")) # Returns None as harry2 is not present in the dictionary
print(myDict["harry2"]) # throws an error as harry2 is not present in the dictionary
SET METHOD
a = {1, 3, 4, 5, 1}
print(type(a))
print(a)
EMPTY SET
# Important: This syntax will create an empty dictionary and not an empty set
a = {}
print(type(a))
# An empty set can be created using the below syntax:
b = set()
print(type(b))
SETS METHOD
# Creating an empty set
b = set()
print(type(b))
## Adding values to an empty set
b.add(4)
b.add(4)
b.add(5)
b.add(5) # Adding a value repeatedly does not changes a set
b.add((4, 5, 6))
## Accessing Elements
# b.add({4:5}) # Cannot add list or dictionary to sets
print(b)
## Length of the Set
print(len(b)) # Prints the length of this set
## Removal of an Item
b.remove(5) # Removes 5 fromt set b
# b.remove(15) # throws an error while trying to remove 15 (which is not present in the set)
print(b)
print(b.pop())
print(b)
PRATICE STORE NUMBER
num1 = int(input("Enter number 1\n"))
num2 = int(input("Enter number 2\n"))
num3 = int(input("Enter number 3\n"))
num4 = int(input("Enter number 4\n"))
num5 = int(input("Enter number 5\n"))
num6 = int(input("Enter number 6\n"))
num7 = int(input("Enter number 7\n"))
num8 = int(input("Enter number 8\n"))
s = {num1, num2, num3, num4, num5, num6, num7, num8}
print(s)
PRATICE SET 2 STORE METHOD
favLang = {}
a = input("Enter your favorite language Shubham\n")
b = input("Enter your favorite language Ankit\n")
c = input("Enter your favorite language Sonali\n")
d = input("Enter your favorite language Harshita\n")
favLang['shubham'] = a
favLang['ankit'] = b
favLang['sonali'] = c
favLang['harshita'] = d
print(favLang)
CONDITION METHOD
a = 8
# 1. if-elif-else ladder in Python
# if(a<3):
# print("The value of a is greater than 3")
# elif(a>13):
# print("The value of a is greater than 13")
# elif(a>7):
# print("The value of a is greater than 7")
# elif(a>17):
# print("The value of a is greater than 17")
# else:
# print("The value is not greater than 3 or 7")
# 2. Multiple if statements
if(a<3):
print("The value of a is greater than 3")
if(a>13):
print("The value of a is greater than 13")
if(a>7):
print("The value of a is greater than 7")
if(a>17):
print("The value of a is greater than 17")
else:
print("The value is not greater than 3 or 7")
print("Done")
IF_else method
age = int(input("Enter your age: "))
if age>18:
print("Yes")
else:
print("No")
logical relation
age = int(input("Enter your age: "))
if(age>34 or age<56):
print("You can work with us")
else:
print("You cannot work with us")
if_else pratice 1
num1 = int(input("Enter number 1: "))
num2 = int(input("Enter number 2: "))
num3 = int(input("Enter number 3: "))
num4 = int(input("Enter number 4: "))
if(num1>num4):
f1 = num1
else:
f1 = num4
if(num2>num3):
f2 = num2
else:
f2 = num3
if(f1>f2):
print(str(f1) + " is greatest")
else:
print(str(f2) + " is greatest")
if_else pratice 2
sub1 = int(input("Enter first subject marks\n"))
sub2 = int(input("Enter second subject marks\n"))
sub3 = int(input("Enter third subject marks\n"))
if(sub1<33 or sub2<33 or sub3<33):
print("You are fail because you have less than 33% in one of the subjects")
elif(sub1+sub2+sub3)/3 < 40:
print("You are fail due to total percentage less than 40")
else:
print("Congatulations! You passed the exam")
if_else pretice 3
text = input("Enter the text\n")
if("make a lot of money" in text):
spam = True
elif("buy now" in text):
spam = True
elif("click this" in text):
spam = True
elif("subscribe this" in text):
spam = True
else:
spam = False
if(spam):
print("This text is spam")
else:
print("This text is not spam")
if_else pratice 4
names = ["harry", "shubham", "rohit", "rohan", "aditi", "shipra"]
name = input("Enter the name to check\n")
if name in names:
print("Your name is present in the list")
else:
print("Your name is not present in the list")
if_else pratice 5
marks = int(input("Enter Your Marks\n"))
if marks>=90:
grade = "Ex"
elif marks>=80:
grade = "A"
elif marks>=70:
grade = "B"
elif marks>=60:
grade = "C"
elif marks>=50:
grade = "D"
else:
grade = "F"
print("Your grade is " + grade)
while loop
i = 0
while i<10:
print("Yes " + str(i))
i = i + 1
print("Done")
while quick
i = 1
while i<=50:
print(i)
i = i + 1
while loop
fruits = ['Banana', 'Watermelon', 'Grapes', 'Mangoes']
i = 0
while i<len(fruits):
print(fruits[i])
i = i+1
for loop
for i in range(10):
print(i)
else:
print("This is inside else of for")
for loop break statement
for i in range(10):
print(i)
if i == 5:
break
else:
print("This is inside else of for")
pass method
i = 4
def run(player):
pass
def ouch(player):
pass
if i>0:
pass
while i>6:
pass
print("Harry is a good boy")
for loop pratice 1
num = int(input("Enter the number"))
for i in range(1, 11):
# print(str(num) + " X " + str(i) + "=" + str(i*num))
print(f"{num}X{i}={num*i}")
for loop pratice 2
l1 = ["Harry", "Sohan", "Sachin", "Rahul"]
for name in l1:
if name.startswith("S"):
print("Hello " + name)
for loop pratice 3
num = int(input("Enter the number: "))
prime = True
for i in range(2, num):
if(num%i == 0):
prime = False
break
if prime:
print("This number is Prime")
else:
print("This number is not Prime")
funtion in python
def percent(marks):
p = ((marks[0] + marks[1] + marks[2]+ marks[3])/400 )*100
return p
marks1 = [45, 78, 86, 77]
percentage1 = percent(marks1)
marks2 = [75, 98, 88, 78]
percentage2 = percent(marks2)
print(percentage1, percentage2)
pratice in funtion 1
def maximum(num1, num2, num3):
if (num1>num2):
if(num1>num3):
return num1
else:
return num3
else:
if(num2>num3):
return num2
else:
return num3
m = maximum(13, 55, 2)
print("The value of the maximum is " + str(m))
pratice in funtion 2
print("Hello", end=" ")
print("How", end=" ")
print("are", end=" ")
print("you?", end=" ")
READLINE IN PYTHON
f = open('sample.txt')
# read first line
data = f.readline()
print(data)
# Read second line
data = f.readline()
print(data)
# Read third line
data = f.readline()
print(data)
# Read fourth line... and so on...
data = f.readline()
print(data)
f.close()
OPEN FILES IN PYTHON
with open('another.txt', 'r') as f:
a = f.read()
with open('another.txt', 'w') as f:
a = f.write("me")
print(a)
PRATICE IN OPEN FILES
f = open('poems.txt')
t = f.read()
if 'twinkle' in t:
print("Twinkle is present")
else:
print("Twinkle is not present")
f.close()
OPEN FILES
words = ["donkey", "kaddu", "mote"]
with open("sample.txt") as f:
content = f.read()
for word in words:
content = content.replace(word, "$%^@$^#")
with open("sample.txt", "w") as f:
f.write(content)
TWO FILES OPEN IN PYTHON
file1 = "log.txt"
file2 = "this.txt"
with open(file1) as f:
f1 = f.read()
with open(file2) as f:
f2= f.read()
if f1 == f2:
print("Files are identical")
else:
print("Files are not identical")
RAILWAY FORM BLUEPRINT PRATICE
import pandas as pd
pd.DataFrame()
class RailwayForm:
formType = "RailwayForm"
def printData(self):
print(f"Name is {self.name}")
print(f"Train is {self.train}")
harrysApplication = RailwayForm()
harrysApplication.name = "SONU"
harrysApplication.train = "Rajdhani Express"
harrysApplication.printData()
PASS FUNTION IN PYTHON
class Remote():
pass
class Player:
def moveRight(self):
pass
def moveLeft(self):
pass
def moveTop(self):
pass
remote1 = Remote()
player1 = Player()
if(remote1.isLeftPressed()):
player1.moveLeft()
EMPLOYEE FUNTION
lass Employee:
company = "Google"
salary = 100
harry = Employee()
rajni = Employee()
harry.salary = 300
rajni.salary = 400
print(harry.company)
print(rajni.company)
Employee.company = "YouTube"
print(harry.company)
print(rajni.company)
print(harry.salary)
print(rajni.salary)
SECOND EMPLOYEE FUNTION
class Employee:
company = "Google"
def getSalary(self, signature):
print(f"Salary for this employee working in {self.company} is {self.salary}\n{signature}")
@staticmethod
def greet():
print("Good Morning, Sir")
@staticmethod
def time():
print("The time is 9AM in the morning")
harry = Employee()
harry.salary = 100000
harry.getSalary("Thanks!") # Employee.getSalary(harry)
harry.greet() # Employee.greet()
harry.time()
CLASS FUNTION
class Employee:
company = "Google"
def __init__(self, name, salary, subunit):
self.name = name
self.salary = salary
self.subunit = subunit
print("Employee is created!")
def getDetails(self):
print(f"The name of the employee is {self.name}")
print(f"The salary of the employee is {self.salary}")
print(f"The subunit of the employee is {self.subunit}")
def getSalary(self, signature):
print(f"Salary for this employee working in {self.company} is {self.salary}\n{signature}")
@staticmethod
def greet():
print("Good Morning, Sir")
@staticmethod
def time():
print("The time is 9AM in the morning")
harry = Employee("Harry", 100, "YouTube")
# harry = Employee() --> This throws an error (missing 3 required positional arguments:)
harry.getDetails()
CLASS FUNTION 2
class Calculator:
def __init__(self, num):
self.number = num
def square(self):
print(f"The value of {self.number} square is {self.number **2}")
def squareRoot(self):
print(f"The value of {self.number} square root is {self.number **0.5}")
def cube(self):
print(f"The value of {self.number} cube is {self.number **3}")
@staticmethod
def greet():
print("*******Hello there welcome to the best calculator of the world*******")
a = Calculator(9)
a.greet()
a.square()
a.squareRoot()
a.cube()
TRAIN TICKET BOOKING FUNTION
class Train:
def __init__(self, name, fare, seats):
self.name = name
self.fare = fare
self.seats = seats
def getStatus(self):
print("************")
print(f"The name of the train is {self.name}")
print(f"The seats available in the train are {self.seats}")
print("************")
def fareInfo(self):
print(f"The price of the ticket is: Rs {self.fare}")
def bookTicket(self):
if(self.seats>0):
print(f"Your ticket has been booked! Your seat number is {self.seats}")
self.seats = self.seats - 1
else:
print("Sorry this train is full! Kindly try in tatkal")
def cancelTicket(self, seatNo):
pass
intercity = Train("Intercity Express: 14015", 90, 2)
intercity.getStatus()
intercity.bookTicket()
intercity.bookTicket()
intercity.bookTicket()
intercity.getStatus()
CLASS FUNTION
class Sample:
def __init__(slf, name):
slf.name = name
obj = Sample("Harry")
print(obj.name)
SINGLE INHERITANCE FUNTION
class Employee:
company = "Google"
def showDetails(self):
print("This is an employee")
class Programmer(Employee):
language = "Python"
# company = "Youtube"
def getLanguage(self):
print(f"The language is {self.language}")
def showDetails(self):
print("This is an programmer")
e = Employee()
e.showDetails()
p = Programmer()
p.showDetails()
print(p.company)
MULTIPLE INHERITANCE
class Freelancer:
company = "Fiverr"
level = 0
def upgradeLevel(self):
self.level = self.level + 1
class Employee:
company = "Visa"
eCode = 120
class Programmer(Freelancer, Employee):
name = "Rohit"
p = Programmer()
p.upgradeLevel()
print(p.company)
MULTILEVEL INHERITANCE
class Person:
country = "India"
def takeBreath(self):
print("I am breathing...")
class Employee(Person):
company = "Honda"
def getSalary(self):
print(f"Salary is {self.salary}")
def takeBreath(self):
print("I am an Employee so I am luckily breathing..")
class Programmer(Employee):
company = "Fiverr"
def getSalary(self):
print(f"No salary to programmers")
def takeBreath(self):
print("I am a Progarmmer so I am breathing++..")
p = Person()
p.takeBreath()
# print(p.company) # throws an error
e = Employee()
e.takeBreath()
print(e.company)
pr = Programmer()
pr.takeBreath()
print(pr.company)
print(pr.country)
SUPER
class Person:
country = "India"
def __init__(self):
print("Initializing Person...\n")
def takeBreath(self):
print("I am breathing...")
class Employee(Person):
company = "Honda"
def __init__(self):
super().__init__()
print("Initializing Employee...\n")
def getSalary(self):
print(f"Salary is {self.salary}")
def takeBreath(self):
super().takeBreath()
print("I am an Employee so I am luckily breathing..")
class Programmer(Employee):
company = "Fiverr"
def __init__(self):
# super().__init__()
print("Initializing Programmer...\n")
def getSalary(self):
print(f"No salary to programmers")
def takeBreath(self):
super().takeBreath()
print("I am a Progarmmer so I am breathing++..")
# p = Person()
# p.takeBreath()
# e = Employee()
# e.takeBreath()
pr = Programmer()
# pr.takeBreath()
ANIMAL FUNTION PRATICE
class Animals:
animalType = "Mammal"
class Pets:
color = "White"
class Dog:
@staticmethod
def bark():
print("Bow bow!")
d = Dog()
d.bark()
PRATICE 2
class Vector:
def __init__(self, vec):
self.vec = vec
def __str__(self):
str1 = ""
index = 0
for i in self.vec:
str1 += f" {i}a{index} +"
index +=1
return str1[:-1]
def __add__(self, vec2):
newList = []
for i in range(len(self.vec)):
newList.append(self.vec[i] + vec2.vec[i])
return Vector(newList)
def __mul__(self, vec2):
sum = 0
for i in range(len(self.vec)):
sum += self.vec[i] * vec2.vec[i]
return sum
v1 = Vector([1, 4, 6])
v2 = Vector([1, 6, 9])
print(v1+v2)
print(v1*v2)
PRATICE 3
class Vector:
def __init__(self, vec):
self.vec = vec
def __str__(self):
return f"{self.vec[0]}i + {self.vec[1]}j + {self.vec[2]}k"
v1 = Vector([1, 4, 6])
v2 = Vector([1, 6, 9])
print(v1)
print(v2)
TRY IN PYTHON
while(True):
print("Press q to quit")
a = input("Enter a number: ")
if a == 'q':
break
try:
print("Trying...")
a = int(a)
if a>6:
print("You entered a number greater than 6")
except Exception as e:
print(f"Your input resulted in an error: {e}")
print("Thanks for playing this game")
TRY FUNTION 2
try:
a = int(input("Enter a number: "))
c = 1/a
print(c)
except ValueError as e:
print("Please Enter a valid value")
except ZeroDivisionError as e:
print("Make sure you are not dividing by 0")
print("Thanks for using this code!")
TRY FUNTION 3
try:
i = int(input("Enter a number: "))
c = 1/i
except Exception as e:
print(e)
exit()
finally:
print("We are done")
print("Thanks for using the program")
LIST COMPREHENSION
a = [3, 6, 7, 8, 9, 2, 4, 23, 75, 23, 123, 67]
# b = []
# for item in a:
# if item%2==0:
# b.append(item)
# print(b)
# Shortcut to write the same:
b = [i for i in a if i%2==0]
print(b)
t = [1, 4, 2, 4, 1, 2, 3]
s = {i for i in t}
print(s)
PRATICE 1
def readFile(filename):
try:
with open(filename, "r") as f:
print(f.read())
except FileNotFoundError:
print(f"File {filename} is not found")
readFile("1.txt")
readFile("2.txt")
readFile("3.txt")
PRATICE 2
l = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
for index, item in enumerate(l):
if index==2 or index== 4 or index==6:
# print(index, item)
print(f"The {index + 1}th element is {item}")
PRATICE 3
num = int(input("Enter your number: "))
table = [num*i for i in range(1, 11)]
print(table)
PRATICE 4
a = int(input("Enter number a: "))
b = int(input("Enter number b: "))
try:
print(a/b)
except:
print("Infinite")
PRATICE 5
num = int(input("Enter your number: "))
table = [num*i for i in range(1, 11)]
print(table)
with open("tables.txt", "a") as f:
f.write(str(table))
f.write('\n')
VIRTUAL FUNTION
# For MacOS/linux users: source myprojectenv/bin/activate
# For windows powershell users: .\myprojectenv\Scripts\activate.ps1
# https://stackoverflow.com/questions/18713086/virtualenv-wont-activate-on-windows
import flask # flask - 0.5.2
import pandas as pd
import pygame
LAMBDA
# def func(a):
# return a+5
func = lambda a: a+5
square = lambda x: x*x
sum = lambda a, b, c: a+b+c
x = 3
print(func(x)) # Prints 8
print(square(x)) # Prints 9
print(sum(x, 1, 2)) # Prints 6
JOIN IN PYTHON
l = ["Camera", "Laptop", "Phone", "ipad", "Hard Disk", "Nvidia Graphic 3080 card"]
# sentence = "~~".join(l)
# sentence = "==".join(l)
sentence = "\n".join(l)
print(sentence)
print(type(sentence))
FUNTION
name = input("Enter your name: ")
marks = input("Enter your marks: ")
phone = input("Enter you phone Number: ")
template = "The name of the student is {}, his marks are {} and phone number is {} "
output = template.format(name, marks, phone)
print(output)
PRATICE 1
l = [1, 2, 3, 4, 5, 6, 7, 8, 9, 1, 2, 3, 4, 54, 23, 55, 90, 60]
a = filter(lambda a: a%5==0, l)
print(list(a))
PRATICE 2
from flask import Flask
app = Flask(__name__)
@app.route('/')
def hello_world():
return '''<!doctype html>
<html lang="en">
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<!-- Bootstrap CSS -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css" integrity="sha384-JcKb8q3iqJ61gNV9KGb8thSsNjpSL0n8PARn9HuZOnIxN0hoP+VmmDGMN5t9UJ0Z" crossorigin="anonymous">
<title>Hello, world!</title>
</head>
<body>
<h1>Hello, world!</h1>
<div class="alert alert-primary" role="alert">
A simple primary alert with <a href="#" class="alert-link">an example link</a>. Give it a click if you like.
</div>
<div class="alert alert-secondary" role="alert">
A simple secondary alert with <a href="#" class="alert-link">an example link</a>. Give it a click if you like.
</div>
<div class="alert alert-success" role="alert">
A simple success alert with <a href="#" class="alert-link">an example link</a>. Give it a click if you like.
</div>
<div class="alert alert-danger" role="alert">
A simple danger alert with <a href="#" class="alert-link">an example link</a>. Give it a click if you like.
</div>
<div class="alert alert-warning" role="alert">
A simple warning alert with <a href="#" class="alert-link">an example link</a>. Give it a click if you like.
</div>
<div class="alert alert-info" role="alert">
A simple info alert with <a href="#" class="alert-link">an example link</a>. Give it a click if you like.
</div>
<div class="alert alert-light" role="alert">
A simple light alert with <a href="#" class="alert-link">an example link</a>. Give it a click if you like.
</div>
<div class="alert alert-dark" role="alert">
A simple dark alert with <a href="#" class="alert-link">an example link</a>. Give it a click if you like.
</div>
<!-- Optional JavaScript -->
<!-- jQuery first, then Popper.js, then Bootstrap JS -->
https://code.jquery.com/jquery-3.5.1.slim.min.js
https://cdn.jsdelivr.net/npm/popper.js@1.16.1/dist/umd/popper.min.js
https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js
</body>
</html>'''
if __name__ == "__main__":
app.run(debug=True)
PROJECT 1 GAMES DESIGN IN PYTHON
import random
# Snake Water Gun or Rock Paper Scissors
def gameWin(comp, you):
# If two values are equal, declare a tie!
if comp == you:
return None
# Check for all possibilities when computer chose s
elif comp == 's':
if you=='w':
return False
elif you=='g':
return True
# Check for all possibilities when computer chose w
elif comp == 'w':
if you=='g':
return False
elif you=='s':
return True
# Check for all possibilities when computer chose g
elif comp == 'g':
if you=='s':
return False
elif you=='w':
return True
print("Comp Turn: Snake(s) Water(w) or Gun(g)?")
randNo = random.randint(1, 3)
if randNo == 1:
comp = 's'
elif randNo == 2:
comp = 'w'
elif randNo == 3:
comp = 'g'
you = input("Your Turn: Snake(s) Water(w) or Gun(g)?")
a = gameWin(comp, you)
print(f"Computer chose {comp}")
print(f"You chose {you}")
if a == None:
print("The game is a tie!")
elif a:
print("You Win!")
else:
print("You Lose!")
PROJECT 2
import random
randNumber = random.randint(1, 100)
userGuess = None
guesses = 0
while(userGuess != randNumber):
userGuess = int(input("Enter your guess: "))
guesses += 1
if(userGuess==randNumber):
print("You guessed it right!")
else:
if(userGuess>randNumber):
print("You guessed it wrong! Enter a smaller number")
else:
print("You guessed it wrong! Enter a larger number")
print(f"You guessed the number in {guesses} guesses")
with open("hiscore.txt", "r") as f:
hiscore = int(f.read())
if(guesses<hiscore):
print("You have just broken the high score!")
with open("hiscore.txt", "w") as f:
f.write(str(guesses))
PROJECT 3
class Library:
def __init__(self, listOfBooks):
self.books = listOfBooks
def displayAvailableBooks(self):
print("Books present in this library are: ")
for book in self.books:
print(" *" + book)
def borrowBook(self, bookName):
if bookName in self.books:
print(f"You have been issued {bookName}. Please keep it safe and return it within 30 days")
self.books.remove(bookName)
return True
else:
print("Sorry, This book is either not available or has already been issued to someone else. Please wait until the book is available")
return False
def returnBook(self, bookName):
self.books.append(bookName)
print("Thanks for returning this book! Hope you enjoyed reading it. Have a great day ahead!")
class Student:
def requestBook(self):
self.book = input("Enter the name of the book you want to borrow: ")
return self.book
def returnBook(self):
self.book = input("Enter the name of the book you want to return: ")
return self.book
if __name__ == "__main__":
centraLibrary = Library(["Algorithms", "Django", "Clrs", "Python Notes"])
student = Student()
# centraLibrary.displayAvailableBooks()
while(True):
welcomeMsg = '''\n ====== Welcome to Central Library ======
Please choose an option:
1. List all the books
2. Request a book
3. Add/Return a book
4. Exit the Library
'''
print(welcomeMsg)
a = int(input("Enter a choice: "))
if a == 1:
centraLibrary.displayAvailableBooks()
elif a == 2:
centraLibrary.borrowBook(student.requestBook())
elif a == 3:
centraLibrary.returnBook(student.returnBook())
elif a == 4:
print("Thanks for choosing Central Library. Have a great day ahead!")
exit()
else:
print("Invalid Choice!")
Check pass ya fail program
Letter1 = '''Congralution! <|NAME|>
you are Selected for a Multinational company
Date : <|DATE|>'''
Letter2 = '''Sorry <|NAME|>
you are Not Selected for a Multinational company
Date : <|DATE|>'''
Name = input("Enter Your Name\n")
Date = input("Enter Your Dates\n")
Letter1 = Letter1.replace("<|NAME|>",Name)
Letter1 = Letter1.replace("<|DATE|>",Date)
Letter2 = Letter2.replace("<|NAME|>",Name)
Letter2 = Letter2.replace("<|DATE|>",Date)
a = ("Sonu","Tejas","ritnesh","satyadev","vivek")
if Name in a:
print(Letter1)
else:
print(Letter2)