<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Shivani tiwari</title>
    <description>The latest articles on DEV Community by Shivani tiwari (@shiwani295).</description>
    <link>https://dev.to/shiwani295</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F889431%2Fb6b82900-b306-46c1-9fe8-3dc93b225eb0.jpeg</url>
      <title>DEV Community: Shivani tiwari</title>
      <link>https://dev.to/shiwani295</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/shiwani295"/>
    <language>en</language>
    <item>
      <title>Authentication Using React-hook-form</title>
      <dc:creator>Shivani tiwari</dc:creator>
      <pubDate>Sat, 25 May 2024 15:34:52 +0000</pubDate>
      <link>https://dev.to/shiwani295/authentication-using-react-hook-form-1e0l</link>
      <guid>https://dev.to/shiwani295/authentication-using-react-hook-form-1e0l</guid>
      <description>&lt;p&gt;Hey Everyone,&lt;/p&gt;

&lt;p&gt;Today I discuss the REACT HOOK FORM  it is easy to use for validating forms, shows the error message and you can easily update the form value as well &lt;/p&gt;

&lt;p&gt;so there are some steps which you have to follow -&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;you can also go through the official website of React Hook form here the link - &lt;a href="https://react-hook-form.com/get-started"&gt;https://react-hook-form.com/get-started&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Install the react hook form by using this link - &lt;a href="https://www.npmjs.com/package/react-hook-form"&gt;https://www.npmjs.com/package/react-hook-form&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;create your Login or signup form first&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;then use the useForm() hook you can so this through the official website for this &lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Example-
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import React from 'react'
import { createUserWithEmailAndPassword } from 'firebase/auth';
import { useForm } from 'react-hook-form';

const Register = ({ history }) =&amp;gt; {
    const {
    handleSubmit,
    formState: { errors },
    trigger,
    register,
    watch
    } = useForm();

    async function onhandleSubmit(data) {
     //console.log(data)
        try {
        await createUserWithEmailAndPassword(
        auth, data.email, data.password, data.name)
        history.push("/");
        alert ("User Created Successfully")
        } catch (error) {
        console.log(error)
        alert ("User created failed")
        alert(error);
      }
    }

 return (
  &amp;lt;div&amp;gt;
    &amp;lt;Form onSubmit={handleSubmit(onhandleSubmit)}&amp;gt;
      &amp;lt;h5&amp;gt;Create an account&amp;lt;/h5&amp;gt;
      &amp;lt;div&amp;gt;
        &amp;lt;div&amp;gt;
         &amp;lt;label&amp;gt;Your email address&amp;lt;/label&amp;gt;
          &amp;lt;input
            id="email"
            name="email"
            type= 'email'
            required={true}
            {...register("email", {
            required: "Email is Required!!!" ,
            pattern: {
            value: /^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}$/i,
            message: "Invalid email address",
            }})}
            error={Boolean(errors.email)}
          &amp;gt;&amp;lt;/input&amp;gt;
          {errors.email &amp;amp;&amp;amp; (
          &amp;lt;small className="text-danger"&amp;gt;{errors.email.message}&amp;lt;/small&amp;gt;
          )}
        &amp;lt;/div&amp;gt;
      &amp;lt;div&amp;gt;
        &amp;lt;label&amp;gt;Your password&amp;lt;/label&amp;gt;
        &amp;lt;input
           name='password'
           id="password"
           type= 'password'
           autoComplete='off'
           className={`form-control ${errors.password &amp;amp;&amp;amp; "invalid"}`}
           required={true}
           {...register("password", {
           required: "You must specify a password",
           pattern: {
           value: '^(?=.*?[A-Z])(?=(.*[a-z]){1,})(?=(.*[\d]){1,})(?=(.*[\W]){    1,})(?!.*\s).{8,}$',
           message: "Password should contain at least one number and one    special character"
           },
          minLength: {
          value: 8,
          message: "Password must be more than 8 characters"
          },
          maxLength: {
          value: 20,
          message: "Password must be less than 20 characters"
          },
          })}
        &amp;gt;&amp;lt;/input&amp;gt;
          {errors.password &amp;amp;&amp;amp; (
          &amp;lt;small className="text-danger"&amp;gt;{errors.password.message}&amp;lt;/small&amp;gt;
          )}
      &amp;lt;/div&amp;gt;
      &amp;lt;div&amp;gt;
        &amp;lt;label&amp;gt;Confirm your password&amp;lt;/label&amp;gt;
        &amp;lt;input
           id="confirmPassword"
           name="confirmPassword"
           type='password'
           {...register( 'confirmPassword', {
           validate: value =&amp;gt;
           value === watch("password", "") || "The passwords do not match"
           })}
           autoComplete='off'
           onPaste={(e) =&amp;gt;{
           e.preventDefault();
           return false
           }}
           error={Boolean(errors.confirmPassword)}
           className={`form-control ${errors.confirmPassword &amp;amp;&amp;amp; "invalid"}`}
           required={true}
         /&amp;gt;
           {errors.confirmPassword &amp;amp;&amp;amp; (
           &amp;lt;small className="text-danger"&amp;gt;{errors.confirmPassword.message}    &amp;lt;/small&amp;gt;
           )}
      &amp;lt;/div&amp;gt;
      &amp;lt;div&amp;gt;
        &amp;lt;label&amp;gt;Your full name&amp;lt;/label&amp;gt;
        &amp;lt;input
           name='name'
           type="name"
           className={`form-control ${errors.name &amp;amp;&amp;amp; "invalid"}`}
           required={true}
           defaultValue=""
          {...register("name", { required: "Fullname is Required!!!" })}
          {errors.name &amp;amp;&amp;amp; (
          &amp;lt;small className="text-danger"&amp;gt;Fullname is Required!!!&amp;lt;/small&amp;gt;
         )}
        &amp;lt;/div&amp;gt;
        &amp;lt;div&amp;gt;
          &amp;lt;button&amp;gt;Create an account&amp;lt;/button&amp;gt;
        &amp;lt;/div&amp;gt;
      &amp;lt;/div&amp;gt;
    &amp;lt;/Form&amp;gt;
  &amp;lt;/div&amp;gt;
)}
export default withRouter(Register)

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;here is the example please go through and if you like this article like my article and follow for more updates &lt;/p&gt;

</description>
      <category>react</category>
      <category>nextjs</category>
      <category>webdev</category>
      <category>javascript</category>
    </item>
    <item>
      <title>Phone Otp login using react Js</title>
      <dc:creator>Shivani tiwari</dc:creator>
      <pubDate>Fri, 25 Aug 2023 07:41:41 +0000</pubDate>
      <link>https://dev.to/shiwani295/phone-otp-login-using-react-js-2gla</link>
      <guid>https://dev.to/shiwani295/phone-otp-login-using-react-js-2gla</guid>
      <description>&lt;p&gt;Hey Every one 🙋‍♀️&lt;/p&gt;

&lt;p&gt;Today I want to share with you Phone OTP login using react &lt;/p&gt;

&lt;p&gt;there is some Features which you have to include &lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Create Project&lt;/strong&gt; - npx create-react-all projectName&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Install react-router-Dom&lt;/strong&gt; -npm i react-router-dom &lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;install react-icon&lt;/strong&gt;- npm install react-icons --save&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Install Firebase using&lt;/strong&gt;  -npm i react-firebase&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;react-phone-input-2&lt;/strong&gt; -  install this  package For Input Field&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;react-otp-input&lt;/strong&gt;  install this  package For Input OTP .&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;react hot toast&lt;/strong&gt; -  install this  package For Beautiful Notification &lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;After Install All these let code here &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Firebase.config,js&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// Import the functions you need from the SDKs you need
import { initializeApp } from "firebase/app";
import { getAuth } from "firebase/auth";
// TODO: Add SDKs for Firebase products that you want to use
// https://firebase.google.com/docs/web/setup#available-libraries

// Your web app's Firebase configuration
const firebaseConfig = {
  apiKey: "AIzaSyDs5ConzFDM2yGvweN-sZdAPFAlowyCDhE",
  authDomain: "reactmoviepp.firebaseapp.com",
  projectId: "reactmoviepp",
  storageBucket: "reactmoviepp.appspot.com",
  messagingSenderId: "719848561957",
  appId: "1:719848561957:web:254facecfb591921474ecc",
};

// Initialize Firebase
const app = initializeApp(firebaseConfig);
export const auth = getAuth(app);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Login.jsx&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import React, { useState } from "react";
import Style from "../Auth/login.module.css";
import bgimg from "../Asset/Img/back.jpg";
import { BiSolidPhoneCall } from "react-icons/bi";
import { BsFillShieldLockFill } from "react-icons/bs";
import PhoneInput from "react-phone-input-2";
import "react-phone-input-2/lib/style.css";
import OtpInput from "react-otp-input";
import { auth } from "../firebase.config";
import { RecaptchaVerifier, signInWithPhoneNumber } from "firebase/auth";
import { Toaster, toast } from "react-hot-toast";
const Login = () =&amp;gt; {
  const [otp, setOtp] = useState("");
  const [ph, setPh] = useState("");
  const [showOtp, setShowOtp] = useState(false);
  const [loading, setLoading] = useState(false);
  const [user, setUser] = useState(false);

  function onCaptchaVerify() {
    if (!window.RecaptchaVerifier) {
      window.recaptchaVerifier = new RecaptchaVerifier(
        auth,
        "recaptcha-container",
        {
          size: "normal",
          callback: (response) =&amp;gt; {
            onSignup();
          },
          "expired-callback": () =&amp;gt; {},
        }
      );
    }
  }

  function onSignup(event) {
    event.preventDefault();
    setLoading(true);
    onCaptchaVerify();
    const appVerifier = window.recaptchaVerifier;
    const phoneNumber = "+" + ph;

    signInWithPhoneNumber(auth, phoneNumber, appVerifier)
      .then((confirmationResult) =&amp;gt; {
        window.confirmationResult = confirmationResult;
        setLoading(false);
        setShowOtp(true);
        toast.success("OTP Sended Sucessfully");
      })
      .catch((error) =&amp;gt; {
        setLoading(false);
        toast.error(error.message);
      });
  }

  function onOtpverify() {
    window.confirmationResult
      .confirm(otp)
      .then(async (result) =&amp;gt; {
        // User signed in successfully.
        const user = result.user;
        setUser(user);
        setLoading(false);
      })
      .catch((error) =&amp;gt; {
        console.log(error.message);
        toast.error(error.message);
      });
  }

  return (
    &amp;lt;div className={`d-flex justify-content-center`}&amp;gt;
      &amp;lt;Toaster toastOptions={{ duration: 4000 }} /&amp;gt;
      &amp;lt;img src={bgimg} alt="bgimg" className={` ${Style.loginimg}`} /&amp;gt;
      {!user ? (
        &amp;lt;div className={`row position-absolute mt-5  `}&amp;gt;
          &amp;lt;div className="signuppage mt-5 bg-dark text-white p-5 "&amp;gt;
            {showOtp ? (
              &amp;lt;div className="optvarificationcontent"&amp;gt;
                &amp;lt;span className="d-flex justify-content-center"&amp;gt;
                  &amp;lt;BsFillShieldLockFill size={40} /&amp;gt;
                &amp;lt;/span&amp;gt;
                &amp;lt;h6 className="text-center mt-3"&amp;gt;Enter Your OTP &amp;lt;/h6&amp;gt;
                &amp;lt;OtpInput
                  value={otp}
                  onChange={setOtp}
                  numInputs={6}
                  shouldAutoFocus
                  renderInput={(props) =&amp;gt; (
                    &amp;lt;input
                      {...props}
                      style={{
                        width: "30px",
                        marginRight: "12px",
                      }}
                    /&amp;gt;
                  )}
                &amp;gt;&amp;lt;/OtpInput&amp;gt;
                &amp;lt;div className="d-flex justify-content-center"&amp;gt;
                  &amp;lt;button
                    className="btn btn-primary mt-3 w-75 "
                    onClick={onOtpverify}
                  &amp;gt;
                    {loading &amp;amp;&amp;amp; (
                      &amp;lt;span
                        className="spinner-border spinner-border-sm"
                        style={{ marginRight: "10px" }}
                      &amp;gt;&amp;lt;/span&amp;gt;
                    )}
                    &amp;lt;span&amp;gt; Verify OTP&amp;lt;/span&amp;gt;
                  &amp;lt;/button&amp;gt;
                &amp;lt;/div&amp;gt;
              &amp;lt;/div&amp;gt;
            ) : (
              &amp;lt;div&amp;gt;
                &amp;lt;span className="d-flex justify-content-center"&amp;gt;
                  &amp;lt;BiSolidPhoneCall size={40} /&amp;gt;
                &amp;lt;/span&amp;gt;
                &amp;lt;h6 className="text-center mt-3"&amp;gt;Verify Your Phone NUmber &amp;lt;/h6&amp;gt;
                &amp;lt;PhoneInput
                  country={"in"}
                  value={ph}
                  onChange={setPh}
                &amp;gt;&amp;lt;/PhoneInput&amp;gt;
                &amp;lt;div className="d-flex justify-content-center"&amp;gt;
                  &amp;lt;button
                    className="btn btn-primary mt-3 w-75 "
                    onClick={onSignup}
                  &amp;gt;
                    {loading &amp;amp;&amp;amp; (
                      &amp;lt;span
                        className="spinner-border spinner-border-sm"
                        style={{ marginRight: "10px" }}
                      &amp;gt;&amp;lt;/span&amp;gt;
                    )}
                    &amp;lt;span&amp;gt;Send OTP Via SMS&amp;lt;/span&amp;gt;
                  &amp;lt;/button&amp;gt;
                &amp;lt;/div&amp;gt;
                &amp;lt;div id="recaptcha-container" className="mt-6"&amp;gt;&amp;lt;/div&amp;gt;
              &amp;lt;/div&amp;gt;
            )}
          &amp;lt;/div&amp;gt;
        &amp;lt;/div&amp;gt;
      ) : (
        &amp;lt;div className=" row position-absolute  text-white p-5"&amp;gt;
          &amp;lt;p style={{ marginTop: "70%" }}&amp;gt;Login Sucessfully&amp;lt;/p&amp;gt;
        &amp;lt;/div&amp;gt;
      )}
    &amp;lt;/div&amp;gt;
  );
};

export default Login;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I hope you Like this article if you like Appreciate me for more content like this 😃😊&lt;/p&gt;

&lt;p&gt;For more Content Check my Instagram - &lt;a href="https://www.instagram.com/coders__village/"&gt;@coders__village&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Thank you &lt;br&gt;
ShivaniTiwari&lt;/p&gt;

</description>
      <category>reactnative</category>
      <category>javascript</category>
      <category>react</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Login Authentication in react js</title>
      <dc:creator>Shivani tiwari</dc:creator>
      <pubDate>Thu, 23 Mar 2023 19:44:20 +0000</pubDate>
      <link>https://dev.to/shiwani295/login-authentication-in-react-js-43ln</link>
      <guid>https://dev.to/shiwani295/login-authentication-in-react-js-43ln</guid>
      <description>&lt;p&gt;hey guys 👋&lt;/p&gt;

&lt;p&gt;Today I will share with you How to work on &lt;strong&gt;Login Authentication in react js&lt;/strong&gt; &lt;/p&gt;

&lt;p&gt;So there is some Points -&lt;/p&gt;

&lt;p&gt;✔ Firstly we will open App.js file and create some routers like - &lt;br&gt;
 Login page (auth.js),homepage,profilepage&lt;br&gt;
✔ when you create all the component with all show on my GitHub &lt;br&gt;
✔ you have to create context component also which i mention in GitHub &lt;/p&gt;

&lt;p&gt;you can the all code on &lt;strong&gt;Login Authentication&lt;/strong&gt; on my GitHub&lt;br&gt;
&lt;a href="https://github.com/shiwani295/LoginAuthentication"&gt;Click here &lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I hope you like it and useful for you ♥♥&lt;/p&gt;

&lt;p&gt;Thank You &lt;br&gt;
Shivani 😊&lt;/p&gt;

</description>
      <category>reactj</category>
      <category>webdev</category>
      <category>javascript</category>
      <category>beginners</category>
    </item>
    <item>
      <title>JavaScript Quiz App with Source Code</title>
      <dc:creator>Shivani tiwari</dc:creator>
      <pubDate>Sun, 05 Feb 2023 17:23:35 +0000</pubDate>
      <link>https://dev.to/shiwani295/javascript-quiz-app-with-source-code-3of8</link>
      <guid>https://dev.to/shiwani295/javascript-quiz-app-with-source-code-3of8</guid>
      <description>&lt;p&gt;hey..&lt;/p&gt;

&lt;p&gt;Today I am going with JavaScript Quiz App&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Features of this Quiz app&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;1) Set timer.&lt;br&gt;
2) Show quiz score as percentage.&lt;br&gt;
3)View correct answer options.&lt;br&gt;
4)Randomize questions.&lt;br&gt;
5)Go back to the previous question.&lt;br&gt;
6)After completing the quiz you will see all the questions and 7)their answers.&lt;br&gt;
8)You can add a JavaScript coding question.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Files Name-&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;asset (Folder)-&amp;gt;
a) index.html
b)css -&amp;gt;
    1) style.css 
c)js -&amp;gt;
    1) script.js
    2)questions.js&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;First File - question.js (JSON File)&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;let jsq_questions = [
    {
        "id": 1,
        "question": "Which of the following is the correct syntax to redirect a URL using JavaScript?",
        "options": {
            "a": "window.location='http://www.google.com';",
            "b": "document.location='http://www.google.com';",
            "c": "browser.location='http://www.google.com';",
            "d": "navigator.location='http://www.google.com';"
        },
        "answer": "a"
    },
    {
        "id": 2,
        "question": "Inside which HTML element do we put the JavaScript?",
        "options": {
            "a": "&amp;lt;javascript&amp;gt;",
            "b": "\x3C/script&amp;gt;",
            "c": "&amp;lt;java&amp;gt;",
            "d": "&amp;lt;js&amp;gt;"
        },
        "answer": "b"
    },
    {
        "id": 3,
        "question": "Which of the following is a valid JavaScript file extension?",
        "options": {
            "a": ".java",
            "b": ".script",
            "c": ".js",
            "d": ".javascript"
        },
        "answer": "c"
    },
    {
        "id": 4,
        "question": " What does CSS stand for?",
        "options": {
            "a": "Computer Style Sheet",
            "b": "Common Style Sheet",
            "c": "Colorful Style Sheet",
            "d": "Cascading Style Sheet"
        },
        "answer": "d"
    },
    {
        "id": 5,
        "question": "what will be the output of this code?",
        "code": "console.log(typeof typeof 1);",
        "options": {
            "a": "number",
            "b": "1",
            "c": "string",
            "d": "true"
        },
        "answer": "c"
    }
];
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Second File-&amp;gt; index.html&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;!DOCTYPE html&amp;gt;
&amp;lt;html lang="en"&amp;gt;

&amp;lt;head&amp;gt;
    &amp;lt;meta charset="UTF-8"&amp;gt;
    &amp;lt;meta name="viewport" content="width=device-width, initial-scale=1.0"&amp;gt;
    &amp;lt;title&amp;gt;JavaScript Quiz&amp;lt;/title&amp;gt;
    &amp;lt;link rel="stylesheet" href="./asset/css/style.css"&amp;gt;
    &amp;lt;!-- Code Highlighter CSS --&amp;gt;
    &amp;lt;link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/prismjs@1.28.0/themes/prism-tomorrow.min.css"&amp;gt;
&amp;lt;/head&amp;gt;

&amp;lt;body&amp;gt;


    &amp;lt;div class="jsq-container" id="jsq_box"&amp;gt;
        &amp;lt;div class="jsq_header" style="display:none;"&amp;gt;
            &amp;lt;div class="jsq_head_text"&amp;gt;JavaScript Simple Quiz Application&amp;lt;/div&amp;gt;
            &amp;lt;div class="jsq_time_left"&amp;gt;Time Left &amp;lt;div id="jsq_timer"&amp;gt;30&amp;lt;/div&amp;gt; &amp;lt;/div&amp;gt;
        &amp;lt;/div&amp;gt;
        &amp;lt;div class="jsq_body"&amp;gt;

            &amp;lt;div id="jsq_ifo_box"&amp;gt;
                &amp;lt;div class="jsq_info_head"&amp;gt;Some Rules of this Quiz&amp;lt;/div&amp;gt;
                &amp;lt;div class="jsq_info_list"&amp;gt;
                    &amp;lt;div&amp;gt;1. You only get 30 seconds for each question.&amp;lt;/div&amp;gt;
                    &amp;lt;div&amp;gt;2. Once you have selected your option, it cannot be undone.&amp;lt;/div&amp;gt;
                    &amp;lt;div&amp;gt;3. You can't select any option once time goes off.&amp;lt;/div&amp;gt;
                    &amp;lt;div&amp;gt;4. You can not skip the quiz while playing.&amp;lt;/div&amp;gt;
                    &amp;lt;div&amp;gt;5. You will get points based on your correct answers.&amp;lt;/div&amp;gt;
                &amp;lt;/div&amp;gt;
                &amp;lt;div class="jsq_info_footer"&amp;gt;
                    &amp;lt;button class="jsq_btn" id="jsq_start"&amp;gt;Start&amp;lt;/button&amp;gt;
                &amp;lt;/div&amp;gt;
            &amp;lt;/div&amp;gt;

            &amp;lt;div class="jsq_main_content" style="display: none;"&amp;gt;
                &amp;lt;h1 id="jsq_question"&amp;gt;&amp;lt;/h1&amp;gt;
                &amp;lt;div id="jsq_code_box"&amp;gt;&amp;lt;pre class="language-js"&amp;gt;&amp;lt;code&amp;gt;&amp;lt;/code&amp;gt;&amp;lt;/pre&amp;gt;&amp;lt;/div&amp;gt;
                &amp;lt;div id="jsq_options"&amp;gt;&amp;lt;/div&amp;gt;
            &amp;lt;/div&amp;gt;

        &amp;lt;/div&amp;gt;

        &amp;lt;div class="jsq_footer" style="display: none;"&amp;gt;
            &amp;lt;button class="jsq_btn" id="prev_question"&amp;gt;Previous&amp;lt;/button&amp;gt;
            &amp;lt;div id="jsq_total"&amp;gt;1 of 5 Questions&amp;lt;/div&amp;gt;
            &amp;lt;button class="jsq_btn" id="next_question"&amp;gt;Next&amp;lt;/button&amp;gt;
        &amp;lt;/div&amp;gt;
    &amp;lt;/div&amp;gt;


    &amp;lt;!-- Code Highlighter JS --&amp;gt;
    &amp;lt;script src="https://cdn.jsdelivr.net/combine/npm/prismjs@1.28.0,npm/prismjs@1.28.0/components/prism-javascript.min.js"&amp;gt;&amp;lt;/script&amp;gt;
    &amp;lt;script src="./asset/js/questions.js"&amp;gt;&amp;lt;/script&amp;gt;
    &amp;lt;script src="./asset/js/script.js"&amp;gt;&amp;lt;/script&amp;gt;
&amp;lt;/body&amp;gt;

&amp;lt;/html&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Third File -&amp;gt; style.css&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;@import url('https://fonts.googleapis.com/css2?family=Open+Sans&amp;amp;display=swap');

body {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100%;
    background-color: #000;
}

* {
    box-sizing: border-box;
}

.jsq-container {
    border-radius: 5px;
    padding: 0 10px;
    color: #000;
    background-color: #fff;
    background-image: linear-gradient(180deg, #e2e2e2 0%, #aeaeae 100%);
    font-family: 'Open Sans', sans-serif;
    width: 500px;
    box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.20);
}

.jsq_header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px;
    border-bottom: solid 1px #c5c5c5;
}

.jsq_footer {
    border-top: 1px solid #9b9b9b;
    padding: 10px 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* info box */
.jsq_info_head {
    padding: 10px 5px;
    font-size: 20px;
    font-weight: bold;
    border-bottom: solid 1px #aaaa;
}

.jsq_info_list {
    padding: 20px;
}

.jsq_info_list &amp;gt; div {
    font-size: 15px;
    margin: 15px 0;
    margin-top: 0;
}

.jsq_info_footer {
    border-top: solid 1px #919191;
    padding: 10px 10px;
    text-align: right;
}

/* timer */
.jsq_time_left {
    display: flex;
    align-items: center;
}

div#jsq_timer {
    border-radius: 50%;
    font-size: 13px;
    width: 28px;
    min-width: 28px;
    color: #fff;
    height: 28px;
    display: flex;
    background-color: #0064ff;
    justify-content: center;
    align-items: center;
    margin-left: 10px;
}

/* show all answers list completed quiz*/
div#jsq_all_answers {
    margin: 30px 0;
    text-align: left;
}

.jsq_fnsh_question {
    font-weight: bold;
    margin-bottom: 5px;
    font-size: 16px;
}

.jsq_finish {
    font-size: 20px;
    font-weight: 500;
}

.jsq_finish_box {
    padding: 20px;
    text-align: center;
}

.jsq_answer_block {
    padding: 10px 10px;
    background-color: #ffffff66;
    border-radius: 5px;
    margin: 5px 0;
}

.jsq_fnsh_options {
    margin: 10px 0;
    margin-left: 20px;
}

.jsq_answer_block span {
    font-size: 13px;
    margin: 7px 0;
    display: block;
    color: #5b5b5b;
}

.jsq_fnsh_score {
    font-size: 13px;
    font-weight: bold;
    color: #0064ff;
}

.jsq_q_status {
    font-size: 13px;
    color: #9a009d;
    font-weight: bold;
    display: inline-block;
}

/* options */
div#jsq_options {
    margin: 15px;
    text-align: center;
    perspective: 500px;
}

div#jsq_options label {
    margin: 20px 0;
    display: block;
    border-radius: 5px;
    font-size: 15px;
    background-color: #e1ebff;
    color: #000000;
    cursor: pointer;
    text-align: left;
    display: flex;
}

div#jsq_options input[type=radio] {
    display: none;
}

div#jsq_options label:not(.disabled):hover {
    background-color: #cdddff;
}

div#jsq_options label.disabled {
    pointer-events: none;
}

/* incorrect option*/
div#jsq_options label.jsq-incorrect {
    color: #ffffff;
    background-color: #e94f4f;
}

/* correct option */
div#jsq_options label.jsq-correct {
    color: #ffffff;
    background-color: #42b55e;
}

/* options ID ABCD */
div#jsq_options label span:first-child {
    border-right: solid 1px #ffffff70;
    padding: 10px 10px;
    display: flex;
    align-items: center;
    border-radius: 4px 0 0 4px;
    font-weight: bold;
}

/* options text */
div#jsq_options label span:last-child {
    display: inline-block;
    padding: 10px 10px;
}

/* question */
h1#jsq_question {
    font-size: 20px;
    margin: 35px 5px;
    line-height: 1.5;
    text-align: center;
    font-weight: 400;
}

/* code box  */
div#jsq_code_box{
    display: none;
    margin: 15px;
}
div#jsq_code_box pre {
    margin: 0;
    padding: 0;
    background: inherit;
}

div#jsq_code_box code {
    line-height: 1.6em;
    overflow: auto;
    font-size: 14px;
    -moz-tab-size: 4;
    display: block;
    tab-size: 4;
    background-color: #2d2d2d;
    padding: 10px;
    border-radius: 5px;
    color: #fff;
    font-family: monospace;
    max-height: 400px;
}

button#next_question, button#prev_question {
    visibility: hidden;
}

button.jsq_btn {
    color: #fff;
    border-radius: 5px;
    background: #007bff;
    border: solid 1px #007bff;
    font-size: 13px;
    padding: 5px 15px;
    cursor: pointer;
}

button.jsq_btn:hover {
    background: #005abd;
    border: solid 1px #005abd;
}

.jsq_score {
    font-size: 25px;
    font-weight: 500;
    color: #102bdc;
    margin-bottom: 40px;
}

.jsq_score b {
    display: block;
    margin: 8px;
    color: #bf28b0;
}

div#jsq_total {
    font-size: 13px;
}

/* animation incorrect option (shaking) */
.jsq_shake {
    animation-name: jsq_shake;
    animation-duration: .8s;
    animation-fill-mode: both;
}

@keyframes jsq_shake {
    0%, 100% {
        transform: translateX(0);
    }

    10%, 30%, 50%, 70%, 90% {
        transform: translateX(-5px);
    }

    20%, 40%, 60%, 80% {
        transform: translateX(5px);
    }

}

/* options animation */
@keyframes jsq_option_anm {
    0% {
        opacity: 0;
        transform-origin: 0 100%;
        transform: rotateX(-180deg);
    }

    100% {
        opacity: 1;
        transform-origin: 0 100%;
        transform: rotateX(0deg);
    }

}

.jsq_anm {
    animation-duration: .5s;
    animation-fill-mode: both;
    animation-name: jsq_option_anm;
    animation-delay: calc(0.1s * var(--jsq_at));
}


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Fourth File-&amp;gt;script.js&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;/**
* code generated by https://www.html-code-generator.com/javascript/quiz-generator
* created 2023/02/05
*/
(() =&amp;gt; {

    // include question array object;
    let questions = jsq_questions;

    let question_index = 0;
    let score = 0;
    let time_left = 30;
    let timer_fun = '';
    let current_question_completed = false;

    const next_button = document.getElementById("next_question");
    const prev_button = document.getElementById("prev_question");
    const start_button = document.getElementById("jsq_start");

    const replaceHTMLtags = text =&amp;gt; text.replace(/&amp;lt;/g, "&amp;amp;lt;").replace(/&amp;gt;/g, "&amp;amp;gt;");
    const stopTimer = () =&amp;gt; {
        clearInterval(timer_fun);
        document.getElementById("jsq_timer").innerHTML = '0';
    };

    const startTimer = (time_value) =&amp;gt; {
        timer_fun = setInterval(() =&amp;gt; {
            if (time_value &amp;lt;= 0) {
                stopTimer();
                optionSelected();
            }
            document.getElementById("jsq_timer").innerHTML = time_value;
            time_value -= 1;

        }, 1000);
    };

    // get all options radio
    const getAllOptions = () =&amp;gt; document.querySelectorAll("input[name=jsq_option]");

    // after selected option disable radio 
    const disableOptions = () =&amp;gt; {
        let option_radios = getAllOptions();
        option_radios.forEach(element =&amp;gt; {
            element.disabled = true;
            element.nextElementSibling.classList.add("disabled");
        });
    };


    // evaluate the user selected option answer
    const optionSelected = () =&amp;gt; {
        let score_set = '0';
        let status = 'time out';
        let answer = questions[question_index].answer;
        let options_radios = getAllOptions();
        options_radios.forEach(element =&amp;gt; {

            // correct answer [color green]
            if (element.value == answer) {
                element.nextElementSibling.classList.add("jsq-correct");
            }

            // user selected incorrect answer [color red]. 
            if (element.checked &amp;amp;&amp;amp; element.value != answer) {
                element.nextElementSibling.classList.add("jsq-incorrect", "jsq_shake");

                // set user selected option. after preview all answers list
                questions[question_index].user_selected = element.value;
                score_set = 0;

                status = 'incorrect answer';
            }

            // user selected answer correct
            if (element.checked &amp;amp;&amp;amp; element.value == answer) {
                score++;
                score_set = 1;

                status = 'correct answer';
            }

        });
        // set question answer status
        questions[question_index].status = status;
        // set score
        questions[question_index].score = score_set;
        // set current question completed
        questions[question_index].completed = true;

        current_question_completed = true;

        disableOptions();
        stopTimer();
        next_button.style.visibility = 'visible';
    };

    // show next question and options
    const showQuestion = () =&amp;gt; {
        let current_question = questions[question_index];
        let options_div = '';
        let options = current_question.options;
        let id_number = 0;
        let option_id = ['A', 'B', 'C', 'D'];

        for (let key in options) {
            options_div += '&amp;lt;div class="jsq_anm" style="--jsq_at:' + (id_number + 1) + '"&amp;gt;' +
                '&amp;lt;input type="radio" name="jsq_option" id="option_' + id_number + '" value="' + key + '"&amp;gt;' +
                '&amp;lt;label for="option_' + id_number + '"&amp;gt;&amp;lt;span&amp;gt;' + option_id[id_number] + '&amp;lt;/span&amp;gt;&amp;lt;span&amp;gt;' + replaceHTMLtags(options[key]) + '&amp;lt;/span&amp;gt;&amp;lt;/label&amp;gt;' +
                '&amp;lt;/div&amp;gt;';
            id_number++;
        }

        document.getElementById("jsq_question").innerText = current_question.question;
        document.getElementById("jsq_options").innerHTML = options_div;
        document.getElementById("jsq_total").innerText = '' + (question_index + 1) + ' of  ' + questions.length + ' Questions';
        showCodeBox(current_question);
        let option_radios = getAllOptions();
        option_radios.forEach(element =&amp;gt; {
            element.addEventListener("change", optionSelected);
        });
        startTimer(time_left);
        current_question_completed = false;
    };

    // show all question answers
    const showAllAnswers = () =&amp;gt; {
        let div = '';
        for (let i = 0; i &amp;lt; questions.length; i++) {
            let question_list = questions[i];
            let options = question_list.options;
            div += '&amp;lt;div class="jsq_answer_block"&amp;gt;';
            div += '&amp;lt;div class="jsq_fnsh_question"&amp;gt;' + (i + 1) + ', ' + replaceHTMLtags(question_list.question) + '&amp;lt;/div&amp;gt;';
            div += '&amp;lt;div class="jsq_fnsh_options"&amp;gt;';
            for (let key in options) {

                if (question_list.answer == key) {
                    div += '&amp;lt;span style="color: green;font-weight: bold;"&amp;gt;' + replaceHTMLtags(options[key]) + '&amp;lt;/span&amp;gt;';
                } else if (question_list.user_selected == key) {
                    div += '&amp;lt;span style="color: red;font-weight: bold;"&amp;gt;' + replaceHTMLtags(options[key]) + '&amp;lt;/span&amp;gt;';
                } else {
                    div += '&amp;lt;span&amp;gt;' + replaceHTMLtags(options[key]) + '&amp;lt;/span&amp;gt;';
                }
            }
            div += '&amp;lt;/div&amp;gt;';
            div += '&amp;lt;div class="jsq_q_status"&amp;gt;status : ' + question_list.status + '&amp;lt;/div&amp;gt;';
            div += '&amp;lt;div class="jsq_fnsh_score"&amp;gt;score : ' + question_list.score + '&amp;lt;/div&amp;gt;';
            div += '&amp;lt;/div&amp;gt;';
        }

        document.getElementById("jsq_all_answers").innerHTML = div;
        document.getElementById("all_answer_btn").remove();
    };

    // If there is coding in this question, it will appear in this code box. show hide box
    const showCodeBox = (current_question) =&amp;gt; {
        let code_box = document.getElementById("jsq_code_box");
        let pre_code = document.querySelector("#jsq_code_box code");

        if (current_question.code == undefined) {
            code_box.style.display = 'none';
            pre_code.innerText = '';
        }else{
            code_box.style.display = 'block';
            pre_code.innerText = current_question.code;
        }
        // highlight code 
        pre_code.innerHTML = Prism.highlight(pre_code.innerText, Prism.languages.javascript, 'javascript');
    };
    // question completed show result
    const completedQuiz = () =&amp;gt; {
        let div = '&amp;lt;div class="jsq_finish_box"&amp;gt;';
        div += '&amp;lt;div class="jsq_finish"&amp;gt;You have completed the Quiz!&amp;lt;/div&amp;gt;';
        div += '&amp;lt;br&amp;gt;';
        div += '&amp;lt;div class="jsq_score"&amp;gt;Your score: &amp;lt;b&amp;gt;' + score + ' out of ' + questions.length + '&amp;lt;/b&amp;gt; &amp;lt;b&amp;gt;' + Math.round((100 * score) / questions.length) + '%&amp;lt;/b&amp;gt;&amp;lt;/div&amp;gt;';
        div += ' &amp;lt;button class="jsq_btn" id="all_answer_btn"&amp;gt;Check your answers&amp;lt;/button&amp;gt;';
        div += '&amp;lt;div id="jsq_all_answers"&amp;gt;&amp;lt;/div&amp;gt;';
        div += '&amp;lt;/div&amp;gt;';
        document.getElementById("jsq_box").innerHTML = div;
        const all_answer_btn = document.getElementById("all_answer_btn");
        all_answer_btn.addEventListener("click", showAllAnswers);
    };


    // go next question
    const nextQuestion = () =&amp;gt; {
        // if option not selected
        if (!current_question_completed) {
            return;
        }

        question_index++;
        if (questions.length - 1 &amp;lt; question_index) {
            stopTimer();
            completedQuiz();
            return;
        }

        next_button.style.visibility = 'hidden';

        if (questions[question_index].completed) {
            next_button.style.visibility = 'visible';
        }

        if (question_index &amp;gt; 0) {
            prev_button.style.visibility = 'visible';
        }

        if (questions[question_index].completed) {
            showPrevQuestion();
        } else {
            showQuestion();
        }
    };

    // show previous question and options
    const showPrevQuestion = () =&amp;gt; {
        let current_question = questions[question_index];
        let options_div = '';
        let options = current_question.options;
        let id_number = 0;
        let option_id = ['A', 'B', 'C', 'D'];

        for (let key in options) {
            let class_name = '';
            if (key == current_question.answer) {
                class_name = 'jsq-correct ';
            }
            if (current_question.user_selected == key) {
                class_name = 'jsq-incorrect ';
            }
            options_div += '&amp;lt;div&amp;gt;' +
                '&amp;lt;input type="radio" name="jsq_option" id="option_' + id_number + '" value="' + key + '" disabled&amp;gt;' +
                '&amp;lt;label for="option_' + id_number + '" class="' + class_name + 'disabled"&amp;gt;&amp;lt;span&amp;gt;' + option_id[id_number] + '&amp;lt;/span&amp;gt;&amp;lt;span&amp;gt;' + replaceHTMLtags(options[key]) + '&amp;lt;/span&amp;gt;&amp;lt;/label&amp;gt;' +
                '&amp;lt;/div&amp;gt;';
            id_number++;
        }
        document.getElementById("jsq_question").innerText = current_question.question;
        document.getElementById("jsq_options").innerHTML = options_div;
        document.getElementById("jsq_total").innerText = '' + (question_index + 1) + ' of  ' + questions.length + ' Questions';
        showCodeBox(current_question);
    };

    // go previous question
    const prevQuestion = () =&amp;gt; {
        if (question_index &amp;lt; 1) {
            return;
        }

        question_index--;
        current_question_completed = (questions[question_index].completed ? true : false);
        if (question_index &amp;lt; 1) {
            prev_button.style.visibility = 'hidden';
        }
        if (question_index &amp;gt;= 0 || questions[question_index].completed) {
            next_button.style.visibility = 'visible';
        }
        stopTimer();
        showPrevQuestion();
    };

    // start quiz
    const startQuiz = () =&amp;gt; {
        document.querySelector(".jsq_header").removeAttribute("style");
        document.querySelector(".jsq_main_content").removeAttribute("style");
        document.querySelector(".jsq_footer").removeAttribute("style");
        document.querySelector("#jsq_ifo_box").remove();
        showQuestion();
    };

    next_button.addEventListener("click", nextQuestion);
    prev_button.addEventListener("click", prevQuestion);
    start_button.addEventListener("click", startQuiz);
    // code generated by https://www.html-code-generator.com/javascript/quiz-generator

})();

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;p&gt;Thank You 😍😍&lt;br&gt;
Shivani Tiwari(Software Developer)&lt;/p&gt;




</description>
      <category>javascript</category>
      <category>webdev</category>
      <category>beginners</category>
      <category>programming</category>
    </item>
    <item>
      <title>what is a React Hooks?</title>
      <dc:creator>Shivani tiwari</dc:creator>
      <pubDate>Wed, 01 Feb 2023 12:44:59 +0000</pubDate>
      <link>https://dev.to/shiwani295/what-is-a-react-hooks-4l0o</link>
      <guid>https://dev.to/shiwani295/what-is-a-react-hooks-4l0o</guid>
      <description>&lt;p&gt;Hooks were added to React in version 16.8.&lt;/p&gt;

&lt;p&gt;Hooks Only allow function components to have access to state and other React features. Because Class Component No longer Needed &lt;/p&gt;

&lt;p&gt;The Hook generally replace class components, there are no plans to remove classes from React.&lt;/p&gt;

&lt;h2&gt;
  
  
  Hook Rules
&lt;/h2&gt;

&lt;p&gt;There Are three Rules -&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Hooks only can called inside the React function component&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;2.Hooks only can called Top of the component &lt;/p&gt;

&lt;p&gt;3.Hooks can not be conditional&lt;/p&gt;

&lt;h2&gt;
  
  
  Example-
&lt;/h2&gt;

&lt;p&gt;Here you must &lt;strong&gt;import&lt;/strong&gt; Hook from &lt;strong&gt;React&lt;/strong&gt;.&lt;br&gt;
Here we are using the **useState **Hook to keep track of the application state.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import React, { useState } from "react";
import ReactDOM from "react-dom/client";

function FavoriteColor() {
  const [color, setColor] = useState("red");

  return (
    &amp;lt;&amp;gt;
      &amp;lt;h1&amp;gt;My favorite color is {color}!&amp;lt;/h1&amp;gt;
      &amp;lt;button
        type="button"
        onClick={() =&amp;gt; setColor("blue")}
      &amp;gt;Blue&amp;lt;/button&amp;gt;
      &amp;lt;button
        type="button"
        onClick={() =&amp;gt; setColor("red")}
      &amp;gt;Red&amp;lt;/button&amp;gt;
      &amp;lt;button
        type="button"
        onClick={() =&amp;gt; setColor("pink")}
      &amp;gt;Pink&amp;lt;/button&amp;gt;
      &amp;lt;button
        type="button"
        onClick={() =&amp;gt; setColor("green")}
      &amp;gt;Green&amp;lt;/button&amp;gt;
    &amp;lt;/&amp;gt;
  );
}

const root = ReactDOM.createRoot(document.getElementById('root'));
root.render(&amp;lt;FavoriteColor /&amp;gt;);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I hope You Like the Article ♥&lt;br&gt;
If you like the Article So follow me 😍&lt;/p&gt;

&lt;p&gt;Thank you &lt;br&gt;
Shivani Frontend Developer&lt;/p&gt;

</description>
      <category>cryptocurrency</category>
      <category>web3</category>
      <category>crypto</category>
    </item>
    <item>
      <title>LeetCode #206 Reverse Linked List</title>
      <dc:creator>Shivani tiwari</dc:creator>
      <pubDate>Thu, 25 Aug 2022 08:59:24 +0000</pubDate>
      <link>https://dev.to/shiwani295/leetcode-206-reverse-linked-list-50ec</link>
      <guid>https://dev.to/shiwani295/leetcode-206-reverse-linked-list-50ec</guid>
      <description>&lt;p&gt;hey everyone👋&lt;/p&gt;

&lt;p&gt;Today We discuss the leetcode #206 problem &lt;/p&gt;

&lt;h2&gt;
  
  
  Problem
&lt;/h2&gt;

&lt;p&gt;Reverse a singly linked list.&lt;/p&gt;

&lt;h2&gt;
  
  
  Example:
&lt;/h2&gt;

&lt;p&gt;Input: 1-&amp;gt;2-&amp;gt;3-&amp;gt;4-&amp;gt;5-&amp;gt;NULL&lt;br&gt;
Output: 5-&amp;gt;4-&amp;gt;3-&amp;gt;2-&amp;gt;1-&amp;gt;NULL&lt;/p&gt;
&lt;h2&gt;
  
  
  Follow up:
&lt;/h2&gt;

&lt;p&gt;A linked list can be reversed either iteratively or recursively. Could you implement both?&lt;/p&gt;
&lt;h2&gt;
  
  
  Solution — Iteration-
&lt;/h2&gt;

&lt;p&gt;Use a pointer that points to a node x which is head at beginning. In each iteration if it has next node y ,move next node to be front of current head and update head pointer to y. Once x has not next node, i.e. it’s tail, end the iteration.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
# Python3

# Definition for singly-linked list.
# class ListNode(object):
#     def __init__(self, x):
#         self.val = x
#         self.next = None

class Solution:
    def reverseList(self, head):
        """
        :type head: ListNode
        :rtype: ListNode
        """

        # Iteration approach
        # Run one pointer p in list. At each iteration:
        #     1. n = p.next
        #     2. p.next = n.next, jump cross n
        #     3. n.next = head, n prepend to the front
        #     4. head = n, reassign head

        if head == None:
            return None

        p = head
        while p.next:
            n = p.next
            p.next = n.next
            n.next = head
            head = n

        return head
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Complexity-
&lt;/h2&gt;

&lt;p&gt;the time &lt;strong&gt;complexity is O(n)&lt;/strong&gt; if n denotes to counts of nodes in this linked list.&lt;/p&gt;

&lt;p&gt;It’s trivial that it only uses &lt;strong&gt;O(1) extra space.&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Solution — Recursion
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# Python3

# Definition for singly-linked list.
# class ListNode(object):
#     def __init__(self, x):
#         self.val = x
#         self.next = None

class Solution:
    def reverseList(self, head):
        """
        :type head: ListNode
        :rtype: ListNode
        """

        # Recursion approach:
        #     take head and reverse list whose head is head.next
        #     then reversely assign the link between them

        if head == None or head.next == None:
            return head

        n = head.next
        h = self.reverseList(n)

        # reverse link
        head.next = None
        n.next = head

        return h
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Complexity
&lt;/h2&gt;

&lt;p&gt;At each function call, it’s only takes** O(1) time for assigning link**. And there are n-2 calls if n denotes to counts of nodes in this linked list. Therefore, time complexity will be O(n).&lt;/p&gt;

&lt;p&gt;Also, it **uses O(1) extra space **in each function call and there are n-2 calls in calling stack. Hence space complexity is O(n) as well.&lt;/p&gt;

&lt;p&gt;Thank you for read this article .I hope its help you to solve this problem &lt;br&gt;
If you like the article so just follow on *&lt;em&gt;@coders_village in instagram *&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Thank You &lt;br&gt;
Shivani Tiwari &lt;br&gt;
(Software Developers)&lt;/p&gt;

</description>
      <category>leetcode</category>
      <category>linkedlist</category>
      <category>dsa</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Write a program by creating an 'Employee' class having the following methods and print the final salary.</title>
      <dc:creator>Shivani tiwari</dc:creator>
      <pubDate>Fri, 05 Aug 2022 11:06:39 +0000</pubDate>
      <link>https://dev.to/shiwani295/write-a-program-by-creating-an-employee-class-having-the-following-methods-and-print-the-final-salary-4ggd</link>
      <guid>https://dev.to/shiwani295/write-a-program-by-creating-an-employee-class-having-the-following-methods-and-print-the-final-salary-4ggd</guid>
      <description>&lt;p&gt;&lt;strong&gt;this is also a question part&lt;/strong&gt; &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1 - 'getInfo()' which takes the salary, number of hours of work per day of employee as parameter&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2 - 'AddSal()' which adds 10 to salary of the employee if it is less than 500.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3 - 'AddWork()' which adds 5 to salary of employee if the number of hours of work per day is more than 6 hours.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Hello Everyone 👋&lt;/p&gt;

&lt;p&gt;You must be seeing the above question. So here we discuss the problem &lt;/p&gt;

&lt;p&gt;There is some few step which we hove do it-&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;First we will create a Employee class&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Create a 3 methods which is mention the about question &lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;. First method getInfo()&lt;br&gt;
   . Second method AddSal()&lt;br&gt;
   . third method AddWork()&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;here we create one more method that is final salary() which give use the employee salary &lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Here is the Ans of this Problem&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;class Employee:

    def __init__(self,name):
        self.name=name

    def getInfo(self,salary,hours):
        self.salary=salary
        self.hours=hours

    def AddSal(self):
        if self.salary&amp;lt;500:
            self.salary+=10
            return self.salary
    def AddWork(self):
        if self.hours&amp;gt;6:
            self.salary+=5
            return self.salary

    def print_final_salary(self):

        print(self.name,self.salary)


name=str(input("enter name:"))
salary=int(input("Enter Salary:"))
hours=float(input("enter hours:"))

emp=Employee(name)
emp.getInfo(salary,hours)
emp.AddSal()
emp.AddWork()
emp.print_final_salary()
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I hope you like will help you for your DSA interview preparation &lt;/p&gt;

&lt;p&gt;Thank You&lt;br&gt;
Shivani Tiwari &lt;/p&gt;

</description>
      <category>ds</category>
      <category>webdev</category>
      <category>interview</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Python Complex Number</title>
      <dc:creator>Shivani tiwari</dc:creator>
      <pubDate>Thu, 14 Jul 2022 12:19:38 +0000</pubDate>
      <link>https://dev.to/shiwani295/python-complex-number-4b33</link>
      <guid>https://dev.to/shiwani295/python-complex-number-4b33</guid>
      <description>&lt;p&gt;hey Everyone &lt;/p&gt;

&lt;p&gt;Today I share you a link where you can read the article related to python complex number &lt;/p&gt;

&lt;p&gt;So Go and check it out -&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;a href="https://codersvillage.com/python/python-complex-number/"&gt;https://codersvillage.com/python/python-complex-number/&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Here is the solution of python complex number so check it out &lt;br&gt;
If you like the article so just hit on ❤️ &lt;/p&gt;

&lt;p&gt;Thank You Everyone &lt;br&gt;
Shivani Tiwari&lt;br&gt;
(software Developer)&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>python</category>
      <category>tutorial</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Write a program to create a class count objects and calculate the number of objects that has been created in realtime.</title>
      <dc:creator>Shivani tiwari</dc:creator>
      <pubDate>Wed, 13 Jul 2022 18:12:42 +0000</pubDate>
      <link>https://dev.to/shiwani295/write-a-program-to-create-a-class-count-objects-and-calculate-the-number-of-objects-that-has-been-created-in-realtime-blj</link>
      <guid>https://dev.to/shiwani295/write-a-program-to-create-a-class-count-objects-and-calculate-the-number-of-objects-that-has-been-created-in-realtime-blj</guid>
      <description>&lt;p&gt;Hey Everyone,&lt;/p&gt;

&lt;p&gt;so today we discuss about the how can we count the object of any class &lt;br&gt;
There is few steps below-&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;First we create the class &lt;strong&gt;count_objects&lt;/strong&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Then we will &lt;strong&gt;initialize class variable (count=0&lt;/strong&gt;) because we want to count the objects not methods &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Then we create the constructor we create always by using &lt;strong&gt;init&lt;/strong&gt; (constructor)&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;4.Than Create an object of &lt;strong&gt;count_objects&lt;/strong&gt; class with attributes&lt;/p&gt;

&lt;p&gt;5.And Finally print the total number of object available in &lt;br&gt;
&lt;strong&gt;count_objects&lt;/strong&gt; class &lt;/p&gt;

&lt;h2&gt;
  
  
  here lets see the Example-
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# Create a count_objects class
class count_objects:

    # initialise class variable
    count = 0

    # Constructor method

    def __init__(self, name, age):

        # instance variable or object attributes
        self.name = name
        self.age = age

        # incrementing the class variable by 1
        # whenever new object is created
        count_objects.count += 1

    # Create a method for printing details

    def printDetails(self):

        print(self.name, self.age, "years old")

# Create an object of Student class with attributes

student1 = count_objects('Ankit Rai', 22)
student2 = count_objects('Aishwarya', 21)
student3 = count_objects('Shaurya', 21)
student4 = count_objects('shiv', 1)

# Print the total no. of objects cretaed

print("Total number of objects created: ", count_objects.count)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;So you can copy that code and print in your editor which editor you use and then see the result .&lt;/p&gt;

&lt;p&gt;I hope this Answer will help you to solve your problem so if you like the article so just like and share the post &lt;/p&gt;

&lt;p&gt;Follow for more updates and visit -&lt;a href="https://codersvillage.com/"&gt;https://codersvillage.com/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Thank you Everyone&lt;br&gt;
Shivani Tiwari &lt;/p&gt;

</description>
      <category>javascript</category>
      <category>beginners</category>
      <category>python</category>
      <category>react</category>
    </item>
    <item>
      <title>Create a class name with variable and Use Constructors to Assign the value creating an object of the class Student.</title>
      <dc:creator>Shivani tiwari</dc:creator>
      <pubDate>Wed, 13 Jul 2022 11:50:24 +0000</pubDate>
      <link>https://dev.to/shiwani295/create-a-class-name-with-variable-and-use-constructors-to-assign-the-value-creating-an-object-of-the-class-student-4d26</link>
      <guid>https://dev.to/shiwani295/create-a-class-name-with-variable-and-use-constructors-to-assign-the-value-creating-an-object-of-the-class-student-4d26</guid>
      <description>&lt;p&gt;Hey Everyone ,&lt;/p&gt;

&lt;p&gt;Here we solved the python oops problem. About we can read the question . there is some step which we have to follow below-&lt;/p&gt;

&lt;h2&gt;
  
  
  *&lt;em&gt;What we do first- *&lt;/em&gt;
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;We create a class name - That is &lt;strong&gt;Student&lt;/strong&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Then we use two variable -One is string that is &lt;strong&gt;name&lt;/strong&gt; and another is integer that is &lt;strong&gt;roll_no&lt;/strong&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Then Use the Constructors for assign the value- That is &lt;strong&gt;2&lt;/strong&gt; and &lt;strong&gt;"John"&lt;/strong&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Solution
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;class Student:
       def __init__(self, name, roll_no):
              self.name = name
              self.roll_no = roll_no
Student1= Student("john", 2)
print(Student1.name)
print(Student1.roll_no)

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;&lt;em&gt;I hope it helps you to solve your query .if you like it do one think follow me for more algo ,python oops updates&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Read More Article Here -&lt;a href="https://codersvillage.co"&gt;https://codersvillage.co&lt;/a&gt;&lt;/strong&gt;m/&lt;/p&gt;

&lt;p&gt;Thank you Everyone &lt;br&gt;
Shivani&lt;/p&gt;

</description>
      <category>oops</category>
      <category>python</category>
      <category>javascript</category>
      <category>beginners</category>
    </item>
    <item>
      <title>How to Create an Empty List in python</title>
      <dc:creator>Shivani tiwari</dc:creator>
      <pubDate>Sat, 09 Jul 2022 12:18:18 +0000</pubDate>
      <link>https://dev.to/shiwani295/how-to-create-an-empty-list-in-python-299d</link>
      <guid>https://dev.to/shiwani295/how-to-create-an-empty-list-in-python-299d</guid>
      <description>&lt;p&gt;Python list is a data structure that can store multiple elements of heterogeneous type. At some point in your program, you may need to create an empty list and add items to it in the subsequent steps.&lt;/p&gt;

&lt;p&gt;In this tutorial, we shall learn how to create an empty list. In other words, a List with no elements.&lt;/p&gt;

&lt;p&gt;To create an empty list in python, assign the variable with empty square brackets.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;[] is an empty list.&lt;/strong&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;mylist = []&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;You can also use list class constructor as shown below to create an empty list.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;mylist = list()&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Example 1: Create an Empty List
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;fruits = []
print(type(fruits))
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Example 2: Create an Empty List
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;fruits = list()
print(type(fruits))
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Read more articles click here -&lt;a href="https://codersvillage.com/"&gt;https://codersvillage.com/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I hope you guys understand how to create empty list if like so support me and follow me for more updates &lt;/p&gt;

&lt;p&gt;Thank you &lt;br&gt;
Everyone &lt;/p&gt;

</description>
      <category>programming</category>
      <category>tutorial</category>
      <category>python</category>
      <category>career</category>
    </item>
    <item>
      <title>Python coding interview questions for data scientist</title>
      <dc:creator>Shivani tiwari</dc:creator>
      <pubDate>Sat, 09 Jul 2022 11:39:31 +0000</pubDate>
      <link>https://dev.to/shiwani295/python-coding-interview-questions-for-data-scientist-d20</link>
      <guid>https://dev.to/shiwani295/python-coding-interview-questions-for-data-scientist-d20</guid>
      <description>&lt;p&gt;1) How do you debug a Python program?&lt;/p&gt;

&lt;p&gt;By using this command we can debug a python program&lt;/p&gt;

&lt;p&gt;Example- Copy this code to your compiler&lt;/p&gt;

&lt;p&gt;$ python -m pdb python-script.py&lt;br&gt;
2) What is  Keyword in Python?&lt;/p&gt;

&lt;p&gt;The  keyword in Python can turn any function into a generator. Yields work like a standard return keyword.&lt;/p&gt;

&lt;p&gt;But it’ll always return a generator object. Also, a function can have multiple calls to the  keyword&lt;/p&gt;

&lt;p&gt;Example- Copy this code to your compiler&lt;/p&gt;

&lt;p&gt;def testgen(index):&lt;br&gt;
weekdays = ['sun','mon','tue','wed','thu','fri','sat']&lt;br&gt;
yield weekdays[index]&lt;br&gt;
yield weekdays[index+1]&lt;br&gt;
day = testgen(0)&lt;br&gt;
print next(day), next(day)&lt;br&gt;
Output: sun mon&lt;br&gt;
Read Article-How to find Count pairs with given sum using python&lt;/p&gt;

&lt;p&gt;3) How to convert a list into a string?&lt;/p&gt;

&lt;p&gt;When we want to convert a list into a string, we can use the &amp;lt;”.join()&amp;gt; method which joins all the elements into one and returns as a string.&lt;/p&gt;

&lt;p&gt;Example- Copy this code to your compiler&lt;/p&gt;

&lt;p&gt;weekdays = ['sun','mon','tue','wed','thu','fri','sat']&lt;br&gt;
listAsString = ' '.join(weekdays)&lt;br&gt;
print(listAsString)P&lt;/p&gt;

&lt;p&gt;4) How to convert a list into a tuple?&lt;/p&gt;

&lt;p&gt;By using Python  function we can convert a list into a tuple. But we can’t change the list after turning it into a tuple, because it becomes immutable.&lt;/p&gt;

&lt;p&gt;Example- Copy this code to your compiler&lt;/p&gt;

&lt;p&gt;weekdays = ['sun','mon','tue','wed','thu','fri','sat']&lt;br&gt;
listAsTuple = tuple(weekdays)&lt;br&gt;
print(listAsTuple)&lt;br&gt;
Read Article-How to Find duplicate elements of an array in python&lt;/p&gt;

&lt;p&gt;5) How to convert a list into a set?&lt;/p&gt;

&lt;p&gt;User can convert list into set by using  function.&lt;/p&gt;

&lt;p&gt;Example- Copy this code to your compiler&lt;/p&gt;

&lt;p&gt;weekdays = ['sun','mon','tue','wed','thu','fri','sat','sun','tue']&lt;br&gt;
listAsSet = set(weekdays)&lt;br&gt;
print(listAsSet)&lt;br&gt;
6) How to count the occurrences of a particular element in the list?&lt;/p&gt;

&lt;p&gt;In the Python list, we can count the occurrences of an individual element by using a  function.&lt;/p&gt;

&lt;p&gt;Example- Copy this code to your compiler&lt;/p&gt;

&lt;p&gt;weekdays = ['sun','mon','tue','wed','thu','fri','sun','mon','mon']&lt;br&gt;
print(weekdays.count('mon'))&lt;br&gt;
7) What is the NumPy array?&lt;/p&gt;

&lt;p&gt;NumPy arrays are more flexible than lists in Python. By using NumPy arrays reading and writing items is faster and more efficient.&lt;/p&gt;

&lt;p&gt;8) How can you create an Empty NumPy Array In Python?&lt;/p&gt;

&lt;p&gt;We can create an Empty NumPy Array in two ways in Python,&lt;/p&gt;

&lt;p&gt;1) import numpy&lt;br&gt;
numpy.array([])&lt;/p&gt;

&lt;p&gt;2) numpy.empty(shape=(0,0))&lt;/p&gt;

&lt;p&gt;9) What is a negative index in Python?&lt;/p&gt;

&lt;p&gt;Python has a special feature like a negative index in Arrays and Lists. A positive index reads the elements from the starting of an array or list but in the negative index, Python reads elements from the end of an array or list.&lt;/p&gt;

&lt;p&gt;10) What is the output of the below code?&lt;/p&gt;

&lt;p&gt;Example- Copy this code to your compiler&lt;/p&gt;

&lt;blockquote&gt;
&lt;blockquote&gt;
&lt;p&gt;import array&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;a = [1, 2, 3]&lt;br&gt;
print a[-3]&lt;br&gt;
print a[-2]&lt;br&gt;
print a[-1]&lt;br&gt;
The output is: 3, 2, 1&lt;/p&gt;
&lt;/blockquote&gt;


&lt;/blockquote&gt;
&lt;br&gt;
&lt;/blockquote&gt;

</description>
      <category>python</category>
      <category>datascience</category>
      <category>programming</category>
      <category>tutorial</category>
    </item>
  </channel>
</rss>
