fpythons 0.1.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- fpythons/__init__.py +12 -0
- fpythons/__main__.py +4 -0
- fpythons/data/00_START_HERE.md +144 -0
- fpythons/data/ALL_SLIPS_CODE.txt +1854 -0
- fpythons/data/README.md +35 -0
- fpythons/data/Slip_01.md +160 -0
- fpythons/data/Slip_02.md +104 -0
- fpythons/data/Slip_03.md +95 -0
- fpythons/data/Slip_04.md +131 -0
- fpythons/data/Slip_05.md +120 -0
- fpythons/data/Slip_06.md +161 -0
- fpythons/data/Slip_07.md +121 -0
- fpythons/data/Slip_08.md +95 -0
- fpythons/data/Slip_09.md +92 -0
- fpythons/data/Slip_10.md +113 -0
- fpythons/data/Slip_11.md +109 -0
- fpythons/data/Slip_12.md +181 -0
- fpythons/data/Slip_13.md +163 -0
- fpythons/data/Slip_14.md +141 -0
- fpythons/data/Slip_15.md +100 -0
- fpythons/data/Slip_16.md +127 -0
- fpythons/data/Slip_17.md +93 -0
- fpythons/data/Slip_18.md +96 -0
- fpythons/data/Slip_19.md +94 -0
- fpythons/data/Slip_20.md +165 -0
- fpythons/data/Slip_21.md +122 -0
- fpythons/data/VIVA.md +195 -0
- fpythons/data/code/slip1/.gitignore +2 -0
- fpythons/data/code/slip1/package.json +31 -0
- fpythons/data/code/slip1/public/index.html +12 -0
- fpythons/data/code/slip1/src/App.js +7 -0
- fpythons/data/code/slip1/src/index.js +10 -0
- fpythons/data/code/slip1/src/slip1/loginForm.js +26 -0
- fpythons/data/code/slip1/src/slip1/style.css +46 -0
- fpythons/data/code/slip10/.gitignore +2 -0
- fpythons/data/code/slip10/package.json +31 -0
- fpythons/data/code/slip10/public/index.html +12 -0
- fpythons/data/code/slip10/src/App.js +7 -0
- fpythons/data/code/slip10/src/index.js +10 -0
- fpythons/data/code/slip10/src/slip10/SumOfDigits.js +37 -0
- fpythons/data/code/slip11/.gitignore +2 -0
- fpythons/data/code/slip11/package.json +31 -0
- fpythons/data/code/slip11/public/index.html +12 -0
- fpythons/data/code/slip11/src/App.js +7 -0
- fpythons/data/code/slip11/src/index.js +10 -0
- fpythons/data/code/slip11/src/slip11/StringOperation.js +33 -0
- fpythons/data/code/slip12/.gitignore +2 -0
- fpythons/data/code/slip12/package.json +33 -0
- fpythons/data/code/slip12/public/index.html +12 -0
- fpythons/data/code/slip12/src/App.js +7 -0
- fpythons/data/code/slip12/src/index.js +14 -0
- fpythons/data/code/slip12/src/slip12/NotesManagementApp.js +35 -0
- fpythons/data/code/slip12/src/slip12/redux/notesSlice.js +20 -0
- fpythons/data/code/slip12/src/slip12/redux/store.js +10 -0
- fpythons/data/code/slip13/.gitignore +2 -0
- fpythons/data/code/slip13/package.json +33 -0
- fpythons/data/code/slip13/public/index.html +12 -0
- fpythons/data/code/slip13/src/App.js +7 -0
- fpythons/data/code/slip13/src/index.js +14 -0
- fpythons/data/code/slip13/src/slip13/Counter.js +20 -0
- fpythons/data/code/slip13/src/slip13/redux/counterSlice.js +19 -0
- fpythons/data/code/slip13/src/slip13/redux/store.js +10 -0
- fpythons/data/code/slip14/.gitignore +2 -0
- fpythons/data/code/slip14/package.json +31 -0
- fpythons/data/code/slip14/public/index.html +12 -0
- fpythons/data/code/slip14/src/App.js +7 -0
- fpythons/data/code/slip14/src/index.js +10 -0
- fpythons/data/code/slip14/src/slip14/Calculator.js +64 -0
- fpythons/data/code/slip15/.gitignore +2 -0
- fpythons/data/code/slip15/package.json +31 -0
- fpythons/data/code/slip15/public/index.html +12 -0
- fpythons/data/code/slip15/src/App.js +7 -0
- fpythons/data/code/slip15/src/index.js +10 -0
- fpythons/data/code/slip15/src/slip15/Counter.js +24 -0
- fpythons/data/code/slip16/.gitignore +2 -0
- fpythons/data/code/slip16/package.json +31 -0
- fpythons/data/code/slip16/public/index.html +12 -0
- fpythons/data/code/slip16/src/App.js +7 -0
- fpythons/data/code/slip16/src/index.js +10 -0
- fpythons/data/code/slip16/src/slip16/TraditionalDOM.html +24 -0
- fpythons/data/code/slip16/src/slip16/VirtualDOM.js +16 -0
- fpythons/data/code/slip17/.gitignore +2 -0
- fpythons/data/code/slip17/package.json +31 -0
- fpythons/data/code/slip17/public/index.html +12 -0
- fpythons/data/code/slip17/src/App.js +7 -0
- fpythons/data/code/slip17/src/index.js +10 -0
- fpythons/data/code/slip17/src/slip17/Sign-in.js +17 -0
- fpythons/data/code/slip18/.gitignore +2 -0
- fpythons/data/code/slip18/package.json +31 -0
- fpythons/data/code/slip18/public/index.html +12 -0
- fpythons/data/code/slip18/public/logo192.png +0 -0
- fpythons/data/code/slip18/src/App.js +7 -0
- fpythons/data/code/slip18/src/index.js +10 -0
- fpythons/data/code/slip18/src/slip18/Profile.js +20 -0
- fpythons/data/code/slip19/.gitignore +2 -0
- fpythons/data/code/slip19/package.json +31 -0
- fpythons/data/code/slip19/public/index.html +12 -0
- fpythons/data/code/slip19/src/App.js +7 -0
- fpythons/data/code/slip19/src/index.js +10 -0
- fpythons/data/code/slip19/src/slip19/Movies.js +19 -0
- fpythons/data/code/slip2/.gitignore +2 -0
- fpythons/data/code/slip2/package.json +31 -0
- fpythons/data/code/slip2/public/index.html +12 -0
- fpythons/data/code/slip2/src/App.js +7 -0
- fpythons/data/code/slip2/src/index.js +10 -0
- fpythons/data/code/slip2/src/slip2/useEffect.js +23 -0
- fpythons/data/code/slip20/.gitignore +2 -0
- fpythons/data/code/slip20/package.json +32 -0
- fpythons/data/code/slip20/public/index.html +12 -0
- fpythons/data/code/slip20/src/App.js +16 -0
- fpythons/data/code/slip20/src/index.js +10 -0
- fpythons/data/code/slip20/src/slip20/Login.js +45 -0
- fpythons/data/code/slip20/src/slip20/Students.js +27 -0
- fpythons/data/code/slip21/.gitignore +2 -0
- fpythons/data/code/slip21/package.json +31 -0
- fpythons/data/code/slip21/public/index.html +12 -0
- fpythons/data/code/slip21/src/App.js +7 -0
- fpythons/data/code/slip21/src/index.js +10 -0
- fpythons/data/code/slip21/src/slip21/NumberString.js +46 -0
- fpythons/data/code/slip3/.gitignore +2 -0
- fpythons/data/code/slip3/package.json +31 -0
- fpythons/data/code/slip3/public/index.html +12 -0
- fpythons/data/code/slip3/src/App.js +7 -0
- fpythons/data/code/slip3/src/index.js +10 -0
- fpythons/data/code/slip3/src/slip3/toggleBtn.js +16 -0
- fpythons/data/code/slip4/.gitignore +2 -0
- fpythons/data/code/slip4/package.json +32 -0
- fpythons/data/code/slip4/public/index.html +12 -0
- fpythons/data/code/slip4/src/App.js +23 -0
- fpythons/data/code/slip4/src/index.js +10 -0
- fpythons/data/code/slip4/src/slip4/About.js +7 -0
- fpythons/data/code/slip4/src/slip4/Contact.js +7 -0
- fpythons/data/code/slip4/src/slip4/home.js +7 -0
- fpythons/data/code/slip5/.gitignore +2 -0
- fpythons/data/code/slip5/package.json +32 -0
- fpythons/data/code/slip5/public/index.html +12 -0
- fpythons/data/code/slip5/src/App.js +18 -0
- fpythons/data/code/slip5/src/index.js +10 -0
- fpythons/data/code/slip5/src/slip5/loginValidation.js +30 -0
- fpythons/data/code/slip6/.gitignore +2 -0
- fpythons/data/code/slip6/package.json +32 -0
- fpythons/data/code/slip6/public/index.html +12 -0
- fpythons/data/code/slip6/src/App.js +31 -0
- fpythons/data/code/slip6/src/index.js +10 -0
- fpythons/data/code/slip6/src/slip6/Dashboard.js +12 -0
- fpythons/data/code/slip6/src/slip6/Login.js +23 -0
- fpythons/data/code/slip6/src/slip6/ProtectedRoute.js +10 -0
- fpythons/data/code/slip7/.gitignore +2 -0
- fpythons/data/code/slip7/package.json +31 -0
- fpythons/data/code/slip7/public/index.html +12 -0
- fpythons/data/code/slip7/src/App.js +7 -0
- fpythons/data/code/slip7/src/index.js +10 -0
- fpythons/data/code/slip7/src/slip7/TodoList.js +42 -0
- fpythons/data/code/slip8/.gitignore +2 -0
- fpythons/data/code/slip8/package.json +31 -0
- fpythons/data/code/slip8/public/index.html +12 -0
- fpythons/data/code/slip8/src/App.js +7 -0
- fpythons/data/code/slip8/src/index.js +10 -0
- fpythons/data/code/slip8/src/slip8/ToggleButton.js +19 -0
- fpythons/data/code/slip9/.gitignore +2 -0
- fpythons/data/code/slip9/package.json +31 -0
- fpythons/data/code/slip9/public/index.html +12 -0
- fpythons/data/code/slip9/src/App.js +7 -0
- fpythons/data/code/slip9/src/index.js +10 -0
- fpythons/data/code/slip9/src/slip9/Counter.js +16 -0
- fpythons/main.py +226 -0
- fpythons-0.1.0.dist-info/METADATA +64 -0
- fpythons-0.1.0.dist-info/RECORD +170 -0
- fpythons-0.1.0.dist-info/WHEEL +4 -0
- fpythons-0.1.0.dist-info/entry_points.txt +2 -0
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "slip19",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"private": true,
|
|
5
|
+
"dependencies": {
|
|
6
|
+
"react": "^19.3.1",
|
|
7
|
+
"react-dom": "^19.3.1",
|
|
8
|
+
"react-scripts": "5.0.1"
|
|
9
|
+
},
|
|
10
|
+
"scripts": {
|
|
11
|
+
"start": "react-scripts start",
|
|
12
|
+
"build": "react-scripts build"
|
|
13
|
+
},
|
|
14
|
+
"eslintConfig": {
|
|
15
|
+
"extends": [
|
|
16
|
+
"react-app"
|
|
17
|
+
]
|
|
18
|
+
},
|
|
19
|
+
"browserslist": {
|
|
20
|
+
"production": [
|
|
21
|
+
">0.2%",
|
|
22
|
+
"not dead",
|
|
23
|
+
"not op_mini all"
|
|
24
|
+
],
|
|
25
|
+
"development": [
|
|
26
|
+
"last 1 chrome version",
|
|
27
|
+
"last 1 firefox version",
|
|
28
|
+
"last 1 safari version"
|
|
29
|
+
]
|
|
30
|
+
}
|
|
31
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8">
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
6
|
+
<title>Slip 19</title>
|
|
7
|
+
</head>
|
|
8
|
+
<body>
|
|
9
|
+
<noscript>You need to enable JavaScript to run this app.</noscript>
|
|
10
|
+
<div id="root"></div>
|
|
11
|
+
</body>
|
|
12
|
+
</html>
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
|
|
3
|
+
const Movies = () => {
|
|
4
|
+
|
|
5
|
+
const movies = ['3 idiots', 'Bhag milkha bhag', 'Shershah', 'Amaran', 'Avengers', 'Drishyam', 'Golmaal', 'Singham', 'Mitwa', 'Timepass'];
|
|
6
|
+
|
|
7
|
+
return (
|
|
8
|
+
<div>
|
|
9
|
+
<h2>Favorite Movies List</h2>
|
|
10
|
+
<ul>
|
|
11
|
+
{movies.map((item, index) =>(
|
|
12
|
+
<li key={index}>{item}</li>
|
|
13
|
+
))}
|
|
14
|
+
</ul>
|
|
15
|
+
</div>
|
|
16
|
+
)
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export default Movies
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "slip2",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"private": true,
|
|
5
|
+
"dependencies": {
|
|
6
|
+
"react": "^19.3.1",
|
|
7
|
+
"react-dom": "^19.3.1",
|
|
8
|
+
"react-scripts": "5.0.1"
|
|
9
|
+
},
|
|
10
|
+
"scripts": {
|
|
11
|
+
"start": "react-scripts start",
|
|
12
|
+
"build": "react-scripts build"
|
|
13
|
+
},
|
|
14
|
+
"eslintConfig": {
|
|
15
|
+
"extends": [
|
|
16
|
+
"react-app"
|
|
17
|
+
]
|
|
18
|
+
},
|
|
19
|
+
"browserslist": {
|
|
20
|
+
"production": [
|
|
21
|
+
">0.2%",
|
|
22
|
+
"not dead",
|
|
23
|
+
"not op_mini all"
|
|
24
|
+
],
|
|
25
|
+
"development": [
|
|
26
|
+
"last 1 chrome version",
|
|
27
|
+
"last 1 firefox version",
|
|
28
|
+
"last 1 safari version"
|
|
29
|
+
]
|
|
30
|
+
}
|
|
31
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8">
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
6
|
+
<title>Slip 2</title>
|
|
7
|
+
</head>
|
|
8
|
+
<body>
|
|
9
|
+
<noscript>You need to enable JavaScript to run this app.</noscript>
|
|
10
|
+
<div id="root"></div>
|
|
11
|
+
</body>
|
|
12
|
+
</html>
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import React, { useState, useEffect } from 'react'
|
|
2
|
+
|
|
3
|
+
const UseEffect = () => {
|
|
4
|
+
const [users, setUsers] = useState([]);
|
|
5
|
+
|
|
6
|
+
useEffect(() =>{
|
|
7
|
+
fetch("https://jsonplaceholder.typicode.com/users")
|
|
8
|
+
.then(res => res.json())
|
|
9
|
+
.then(data =>{ setUsers(data);
|
|
10
|
+
console.log(data);
|
|
11
|
+
})
|
|
12
|
+
}, [])
|
|
13
|
+
return (
|
|
14
|
+
<div>
|
|
15
|
+
<h1>User List:</h1>
|
|
16
|
+
{users.map(user =>(
|
|
17
|
+
<p key={user.id}>{user.name}</p>
|
|
18
|
+
))}
|
|
19
|
+
</div>
|
|
20
|
+
)
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export default UseEffect
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "slip20",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"private": true,
|
|
5
|
+
"dependencies": {
|
|
6
|
+
"react": "^19.3.1",
|
|
7
|
+
"react-dom": "^19.3.1",
|
|
8
|
+
"react-router-dom": "^7.18.7",
|
|
9
|
+
"react-scripts": "5.0.1"
|
|
10
|
+
},
|
|
11
|
+
"scripts": {
|
|
12
|
+
"start": "react-scripts start",
|
|
13
|
+
"build": "react-scripts build"
|
|
14
|
+
},
|
|
15
|
+
"eslintConfig": {
|
|
16
|
+
"extends": [
|
|
17
|
+
"react-app"
|
|
18
|
+
]
|
|
19
|
+
},
|
|
20
|
+
"browserslist": {
|
|
21
|
+
"production": [
|
|
22
|
+
">0.2%",
|
|
23
|
+
"not dead",
|
|
24
|
+
"not op_mini all"
|
|
25
|
+
],
|
|
26
|
+
"development": [
|
|
27
|
+
"last 1 chrome version",
|
|
28
|
+
"last 1 firefox version",
|
|
29
|
+
"last 1 safari version"
|
|
30
|
+
]
|
|
31
|
+
}
|
|
32
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8">
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
6
|
+
<title>Slip 20</title>
|
|
7
|
+
</head>
|
|
8
|
+
<body>
|
|
9
|
+
<noscript>You need to enable JavaScript to run this app.</noscript>
|
|
10
|
+
<div id="root"></div>
|
|
11
|
+
</body>
|
|
12
|
+
</html>
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { BrowserRouter, Routes, Route } from 'react-router-dom';
|
|
2
|
+
import Login from './slip20/Login';
|
|
3
|
+
import Students from './slip20/Students';
|
|
4
|
+
|
|
5
|
+
function App() {
|
|
6
|
+
return (
|
|
7
|
+
<BrowserRouter>
|
|
8
|
+
<Routes>
|
|
9
|
+
<Route path="/" element={<Login />} />
|
|
10
|
+
<Route path="/user/:id" element={<Students />} />
|
|
11
|
+
</Routes>
|
|
12
|
+
</BrowserRouter>
|
|
13
|
+
);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export default App;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
import { useNavigate } from 'react-router-dom';
|
|
3
|
+
|
|
4
|
+
const Login = () => {
|
|
5
|
+
|
|
6
|
+
const [id, setId] = useState('');
|
|
7
|
+
const [username, setUsername] = useState('');
|
|
8
|
+
const [password, setPassword] = useState('');
|
|
9
|
+
const navigate = useNavigate();
|
|
10
|
+
|
|
11
|
+
const users = [
|
|
12
|
+
{id: 101, name: 'Asha'},
|
|
13
|
+
{id: 102, name: 'Rahul'},
|
|
14
|
+
{id: 103, name: 'Urmila'},
|
|
15
|
+
{id: 104, name: 'Satish'}
|
|
16
|
+
];
|
|
17
|
+
|
|
18
|
+
const handleSubmit = (e) =>{
|
|
19
|
+
e.preventDefault();
|
|
20
|
+
const user = users.find((item) => item.id === Number(id));
|
|
21
|
+
if(user !== undefined && username === 'Admin' && password === '1234'){
|
|
22
|
+
navigate(`/user/${id}`);
|
|
23
|
+
}
|
|
24
|
+
else{
|
|
25
|
+
alert("Invalid credentials");
|
|
26
|
+
}
|
|
27
|
+
console.log("Id: ", id);
|
|
28
|
+
console.log("Username: ", username);
|
|
29
|
+
console.log("Password: ", password);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
return (
|
|
33
|
+
<div>
|
|
34
|
+
<h2>Login Form</h2>
|
|
35
|
+
<form onSubmit={handleSubmit}>
|
|
36
|
+
<label>UserId<input type='text' value={id} onChange={(e) => setId(e.target.value)}></input></label><br></br>
|
|
37
|
+
<label>Username<input type='text' value={username} onChange={(e) => setUsername(e.target.value)}></input></label><br></br>
|
|
38
|
+
<label>Password<input type='password' value={password} onChange={(e) => setPassword(e.target.value)}></input></label><br></br>
|
|
39
|
+
<button type='submit'>Login</button>
|
|
40
|
+
</form>
|
|
41
|
+
</div>
|
|
42
|
+
)
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export default Login
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import {useParams} from 'react-router-dom';
|
|
3
|
+
|
|
4
|
+
const Students = () => {
|
|
5
|
+
|
|
6
|
+
const {id} = useParams();
|
|
7
|
+
const users = [
|
|
8
|
+
{id: 101, name: 'Asha'},
|
|
9
|
+
{id: 102, name: 'Rahul'},
|
|
10
|
+
{id: 103, name: 'Urmila'},
|
|
11
|
+
{id: 104, name: 'Satish'}
|
|
12
|
+
];
|
|
13
|
+
|
|
14
|
+
const user = users.find((item) => item.id === Number(id));
|
|
15
|
+
|
|
16
|
+
return (
|
|
17
|
+
<div>
|
|
18
|
+
{user ? (<div>
|
|
19
|
+
<h2>Student Id: {user.id}</h2>
|
|
20
|
+
<p>Student Name: {user.name}</p>
|
|
21
|
+
</div>
|
|
22
|
+
) : (<h2>User not found</h2>)}
|
|
23
|
+
</div>
|
|
24
|
+
)
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export default Students
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "slip21",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"private": true,
|
|
5
|
+
"dependencies": {
|
|
6
|
+
"react": "^19.3.1",
|
|
7
|
+
"react-dom": "^19.3.1",
|
|
8
|
+
"react-scripts": "5.0.1"
|
|
9
|
+
},
|
|
10
|
+
"scripts": {
|
|
11
|
+
"start": "react-scripts start",
|
|
12
|
+
"build": "react-scripts build"
|
|
13
|
+
},
|
|
14
|
+
"eslintConfig": {
|
|
15
|
+
"extends": [
|
|
16
|
+
"react-app"
|
|
17
|
+
]
|
|
18
|
+
},
|
|
19
|
+
"browserslist": {
|
|
20
|
+
"production": [
|
|
21
|
+
">0.2%",
|
|
22
|
+
"not dead",
|
|
23
|
+
"not op_mini all"
|
|
24
|
+
],
|
|
25
|
+
"development": [
|
|
26
|
+
"last 1 chrome version",
|
|
27
|
+
"last 1 firefox version",
|
|
28
|
+
"last 1 safari version"
|
|
29
|
+
]
|
|
30
|
+
}
|
|
31
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8">
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
6
|
+
<title>Slip 21</title>
|
|
7
|
+
</head>
|
|
8
|
+
<body>
|
|
9
|
+
<noscript>You need to enable JavaScript to run this app.</noscript>
|
|
10
|
+
<div id="root"></div>
|
|
11
|
+
</body>
|
|
12
|
+
</html>
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
|
|
3
|
+
const NumberString = () => {
|
|
4
|
+
|
|
5
|
+
const [number, setNumber] = useState('');
|
|
6
|
+
const [string, setString] = useState('');
|
|
7
|
+
const [numberResult, setNumberResult] = useState(null);
|
|
8
|
+
const [stringResult, setStringResult] = useState(null);
|
|
9
|
+
|
|
10
|
+
const EvenOdd = () =>{
|
|
11
|
+
if(Number(number) % 2 === 0){
|
|
12
|
+
setNumberResult("Even");
|
|
13
|
+
}else{
|
|
14
|
+
setNumberResult("Odd");
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const checkPalindrome = () =>{
|
|
19
|
+
let str = string.split('').reverse().join('');
|
|
20
|
+
if(str === string){
|
|
21
|
+
setStringResult("Palindrome");
|
|
22
|
+
}else{
|
|
23
|
+
setStringResult("Not palidrome");
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const handleSubmit = (e) =>{
|
|
28
|
+
e.preventDefault();
|
|
29
|
+
EvenOdd();
|
|
30
|
+
checkPalindrome();
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
return (
|
|
34
|
+
<div>
|
|
35
|
+
<form onSubmit={handleSubmit}>
|
|
36
|
+
<label>Enter number:<input type='text' value={number} onChange={(e) => setNumber(e.target.value)}></input></label>
|
|
37
|
+
<label>Enter string:<input type='text' value={string} onChange={(e) => setString(e.target.value)}></input></label>
|
|
38
|
+
<button type='submit'>Check</button>
|
|
39
|
+
</form>
|
|
40
|
+
<p>Number is {numberResult}</p>
|
|
41
|
+
<p>String is {stringResult}</p>
|
|
42
|
+
</div>
|
|
43
|
+
)
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export default NumberString
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "slip3",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"private": true,
|
|
5
|
+
"dependencies": {
|
|
6
|
+
"react": "^19.3.1",
|
|
7
|
+
"react-dom": "^19.3.1",
|
|
8
|
+
"react-scripts": "5.0.1"
|
|
9
|
+
},
|
|
10
|
+
"scripts": {
|
|
11
|
+
"start": "react-scripts start",
|
|
12
|
+
"build": "react-scripts build"
|
|
13
|
+
},
|
|
14
|
+
"eslintConfig": {
|
|
15
|
+
"extends": [
|
|
16
|
+
"react-app"
|
|
17
|
+
]
|
|
18
|
+
},
|
|
19
|
+
"browserslist": {
|
|
20
|
+
"production": [
|
|
21
|
+
">0.2%",
|
|
22
|
+
"not dead",
|
|
23
|
+
"not op_mini all"
|
|
24
|
+
],
|
|
25
|
+
"development": [
|
|
26
|
+
"last 1 chrome version",
|
|
27
|
+
"last 1 firefox version",
|
|
28
|
+
"last 1 safari version"
|
|
29
|
+
]
|
|
30
|
+
}
|
|
31
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8">
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
6
|
+
<title>Slip 3</title>
|
|
7
|
+
</head>
|
|
8
|
+
<body>
|
|
9
|
+
<noscript>You need to enable JavaScript to run this app.</noscript>
|
|
10
|
+
<div id="root"></div>
|
|
11
|
+
</body>
|
|
12
|
+
</html>
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React, { useState } from 'react'
|
|
2
|
+
|
|
3
|
+
const ToggleBtn = () => {
|
|
4
|
+
const [status, setStatus] = useState('ON');
|
|
5
|
+
function checkStatus(){
|
|
6
|
+
setStatus(status === 'ON' ? 'OFF' : 'ON');
|
|
7
|
+
}
|
|
8
|
+
return (
|
|
9
|
+
<div style = {{backgroundColor : status === 'ON' ? 'lightgreen' : 'lightcoral'}}>
|
|
10
|
+
<h2>{status}</h2>
|
|
11
|
+
<button onClick={checkStatus}>{status === 'ON' ? 'Turn OFF' : 'Turn ON'}</button>
|
|
12
|
+
</div>
|
|
13
|
+
)
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export default ToggleBtn
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "slip4",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"private": true,
|
|
5
|
+
"dependencies": {
|
|
6
|
+
"react": "^19.3.1",
|
|
7
|
+
"react-dom": "^19.3.1",
|
|
8
|
+
"react-router-dom": "^7.18.7",
|
|
9
|
+
"react-scripts": "5.0.1"
|
|
10
|
+
},
|
|
11
|
+
"scripts": {
|
|
12
|
+
"start": "react-scripts start",
|
|
13
|
+
"build": "react-scripts build"
|
|
14
|
+
},
|
|
15
|
+
"eslintConfig": {
|
|
16
|
+
"extends": [
|
|
17
|
+
"react-app"
|
|
18
|
+
]
|
|
19
|
+
},
|
|
20
|
+
"browserslist": {
|
|
21
|
+
"production": [
|
|
22
|
+
">0.2%",
|
|
23
|
+
"not dead",
|
|
24
|
+
"not op_mini all"
|
|
25
|
+
],
|
|
26
|
+
"development": [
|
|
27
|
+
"last 1 chrome version",
|
|
28
|
+
"last 1 firefox version",
|
|
29
|
+
"last 1 safari version"
|
|
30
|
+
]
|
|
31
|
+
}
|
|
32
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8">
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
6
|
+
<title>Slip 4</title>
|
|
7
|
+
</head>
|
|
8
|
+
<body>
|
|
9
|
+
<noscript>You need to enable JavaScript to run this app.</noscript>
|
|
10
|
+
<div id="root"></div>
|
|
11
|
+
</body>
|
|
12
|
+
</html>
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { BrowserRouter, Routes, Route, Link } from 'react-router-dom';
|
|
2
|
+
import Home from './slip4/home';
|
|
3
|
+
import About from './slip4/About';
|
|
4
|
+
import Contact from './slip4/Contact';
|
|
5
|
+
|
|
6
|
+
function App() {
|
|
7
|
+
return (
|
|
8
|
+
<BrowserRouter>
|
|
9
|
+
<Link to="/">Home</Link> |{' '}
|
|
10
|
+
<Link to="/about">About</Link> |{' '}
|
|
11
|
+
<Link to="/contact">Contact Us</Link>
|
|
12
|
+
|
|
13
|
+
<Routes>
|
|
14
|
+
<Route path="/" element={<Home />} />
|
|
15
|
+
<Route path="/about" element={<About />} />
|
|
16
|
+
<Route path="/contact" element={<Contact />} />
|
|
17
|
+
<Route path="*" element={<h1>Page Not Found!</h1>} />
|
|
18
|
+
</Routes>
|
|
19
|
+
</BrowserRouter>
|
|
20
|
+
);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export default App;
|