<?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: ABUL HASAN A</title>
    <description>The latest articles on DEV Community by ABUL HASAN A (@abul_4693).</description>
    <link>https://dev.to/abul_4693</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%2F1164957%2F8cf9c994-1c68-4525-be99-53525c9b164d.jpeg</url>
      <title>DEV Community: ABUL HASAN A</title>
      <link>https://dev.to/abul_4693</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/abul_4693"/>
    <language>en</language>
    <item>
      <title>task 26</title>
      <dc:creator>ABUL HASAN A</dc:creator>
      <pubDate>Thu, 30 May 2024 18:00:32 +0000</pubDate>
      <link>https://dev.to/abul_4693/task-26-7c0</link>
      <guid>https://dev.to/abul_4693/task-26-7c0</guid>
      <description>&lt;p&gt;1) from selenium import webdriver&lt;br&gt;
from selenium.webdriver.common.by import By&lt;br&gt;
from selenium.webdriver.support.ui import WebDriverWait&lt;br&gt;
from selenium.webdriver.support import expected_conditions as EC&lt;/p&gt;

&lt;h1&gt;
  
  
  Initialize Chrome WebDriver
&lt;/h1&gt;

&lt;p&gt;driver = webdriver.Chrome()&lt;/p&gt;

&lt;h1&gt;
  
  
  Navigate to IMDb search page
&lt;/h1&gt;

&lt;p&gt;driver.get("&lt;a href="https://www.imdb.com/search/name/%22"&gt;https://www.imdb.com/search/name/"&lt;/a&gt;)&lt;/p&gt;

&lt;h1&gt;
  
  
  Wait for the search input field to be visible
&lt;/h1&gt;

&lt;p&gt;try:&lt;br&gt;
    search_input = WebDriverWait(driver, 10).until(&lt;br&gt;
        EC.visibility_of_element_located((By.ID, "navbar-query"))&lt;br&gt;
    )&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# Verify if the search input field is visible
if search_input:
    print("Successfully navigated to IMDb search page.")
else:
    print("Failed to navigate to IMDb search page.")
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;except Exception as e:&lt;br&gt;
    print(f"An error occurred: {e}")&lt;/p&gt;

&lt;p&gt;finally:&lt;br&gt;
    # Close the browser session&lt;br&gt;
    driver.quit()&lt;br&gt;
2) from selenium import webdriver&lt;br&gt;
from selenium.webdriver.common.by import By&lt;br&gt;
from selenium.webdriver.support.ui import WebDriverWait&lt;br&gt;
from selenium.webdriver.support import expected_conditions as EC&lt;/p&gt;

&lt;h1&gt;
  
  
  Initialize Chrome WebDriver
&lt;/h1&gt;

&lt;p&gt;driver = webdriver.Chrome()&lt;/p&gt;

&lt;h1&gt;
  
  
  Navigate to the webpage
&lt;/h1&gt;

&lt;p&gt;driver.get("&lt;a href="https://www.example.com%22"&gt;https://www.example.com"&lt;/a&gt;)  # Replace with the actual URL&lt;/p&gt;

&lt;p&gt;try:&lt;br&gt;
    # Define an explicit wait&lt;br&gt;
    wait = WebDriverWait(driver, 10)&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# Fill data in input boxes
input_box1 = wait.until(EC.visibility_of_element_located((By.ID, "input-box1")))
input_box1.send_keys("Data for input box 1")

input_box2 = wait.until(EC.visibility_of_element_located((By.ID, "input-box2")))
input_box2.send_keys("Data for input box 2")

# Select options in select boxes
select_box1 = wait.until(EC.visibility_of_element_located((By.ID, "select-box1")))
select_box1.click()
option1 = wait.until(EC.visibility_of_element_located((By.XPATH, "//option[text()='Option 1']")))
option1.click()

select_box2 = wait.until(EC.visibility_of_element_located((By.ID, "select-box2")))
select_box2.click()
option2 = wait.until(EC.visibility_of_element_located((By.XPATH, "//option[text()='Option 2']")))
option2.click()

# Choose options in dropdown menus
dropdown_menu1 = wait.until(EC.visibility_of_element_located((By.ID, "dropdown-menu1")))
dropdown_menu1.click()
dropdown_menu1_option = wait.until(EC.visibility_of_element_located((By.XPATH, "//li[text()='Option 1']")))
dropdown_menu1_option.click()

dropdown_menu2 = wait.until(EC.visibility_of_element_located((By.ID, "dropdown-menu2")))
dropdown_menu2.click()
dropdown_menu2_option = wait.until(EC.visibility_of_element_located((By.XPATH, "//li[text()='Option 2']")))
dropdown_menu2_option.click()

# Perform a search
search_button = wait.until(EC.element_to_be_clickable((By.ID, "search-button")))
search_button.click()

print("Data filled in input boxes, select boxes, and dropdown menus. Search performed successfully.")
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;except Exception as e:&lt;br&gt;
    print(f"An error occurred: {e}")&lt;/p&gt;

&lt;p&gt;finally:&lt;br&gt;
    # Close the browser session&lt;br&gt;
    driver.quit()&lt;br&gt;
3) from selenium import webdriver&lt;br&gt;
from selenium.webdriver.common.by import By&lt;br&gt;
from selenium.webdriver.support.ui import WebDriverWait&lt;br&gt;
from selenium.webdriver.support import expected_conditions as EC&lt;/p&gt;

&lt;h1&gt;
  
  
  Initialize Chrome WebDriver
&lt;/h1&gt;

&lt;p&gt;driver = webdriver.Chrome()&lt;/p&gt;

&lt;h1&gt;
  
  
  Navigate to the webpage
&lt;/h1&gt;

&lt;p&gt;driver.get("&lt;a href="https://www.example.com%22"&gt;https://www.example.com"&lt;/a&gt;)  # Replace with the actual URL&lt;/p&gt;

&lt;p&gt;try:&lt;br&gt;
    # Define an explicit wait&lt;br&gt;
    wait = WebDriverWait(driver, 10)&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# Fill data in input boxes
input_box1 = wait.until(EC.visibility_of_element_located((By.ID, "input-box1")))
input_box1.send_keys("Data for input box 1")

input_box2 = wait.until(EC.visibility_of_element_located((By.ID, "input-box2")))
input_box2.send_keys("Data for input box 2")

# Select options in select boxes
select_box1 = wait.until(EC.element_to_be_clickable((By.ID, "select-box1")))
select_box1.click()
option1 = wait.until(EC.visibility_of_element_located((By.XPATH, "//option[text()='Option 1']")))
option1.click()

select_box2 = wait.until(EC.element_to_be_clickable((By.ID, "select-box2")))
select_box2.click()
option2 = wait.until(EC.visibility_of_element_located((By.XPATH, "//option[text()='Option 2']")))
option2.click()

# Choose options in dropdown menus
dropdown_menu1 = wait.until(EC.element_to_be_clickable((By.ID, "dropdown-menu1")))
dropdown_menu1.click()
dropdown_menu1_option = wait.until(EC.visibility_of_element_located((By.XPATH, "//li[text()='Option 1']")))
dropdown_menu1_option.click()

dropdown_menu2 = wait.until(EC.element_to_be_clickable((By.ID, "dropdown-menu2")))
dropdown_menu2.click()
dropdown_menu2_option = wait.until(EC.visibility_of_element_located((By.XPATH, "//li[text()='Option 2']")))
dropdown_menu2_option.click()

# Perform a search
search_button = wait.until(EC.element_to_be_clickable((By.ID, "search-button")))
search_button.click()

print("Data filled in input boxes, select boxes, and dropdown menus. Search performed successfully.")
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;except Exception as e:&lt;br&gt;
    print(f"An error occurred: {e}")&lt;/p&gt;

&lt;p&gt;finally:&lt;br&gt;
    # Close the browser session&lt;br&gt;
    driver.quit()&lt;/p&gt;

</description>
    </item>
    <item>
      <title>task 25</title>
      <dc:creator>ABUL HASAN A</dc:creator>
      <pubDate>Thu, 30 May 2024 17:45:35 +0000</pubDate>
      <link>https://dev.to/abul_4693/task-25-1fc7</link>
      <guid>https://dev.to/abul_4693/task-25-1fc7</guid>
      <description>&lt;p&gt;1) from selenium import webdriver&lt;br&gt;
from selenium.webdriver.common.by import By&lt;br&gt;
from selenium.webdriver.support.ui import WebDriverWait&lt;br&gt;
from selenium.webdriver.support import expected_conditions as EC&lt;/p&gt;

&lt;h1&gt;
  
  
  Initialize Chrome WebDriver
&lt;/h1&gt;

&lt;p&gt;driver = webdriver.Chrome()&lt;/p&gt;

&lt;h1&gt;
  
  
  Navigate to IMDb search page
&lt;/h1&gt;

&lt;p&gt;driver.get("&lt;a href="https://www.imdb.com/search/name/%22"&gt;https://www.imdb.com/search/name/"&lt;/a&gt;)&lt;/p&gt;

&lt;h1&gt;
  
  
  Wait for the search input field to be visible
&lt;/h1&gt;

&lt;p&gt;search_input = WebDriverWait(driver, 10).until(&lt;br&gt;
    EC.visibility_of_element_located((By.ID, "navbar-query"))&lt;br&gt;
)&lt;/p&gt;

&lt;h1&gt;
  
  
  Verify if the search input field is visible
&lt;/h1&gt;

&lt;p&gt;if search_input:&lt;br&gt;
    print("Successfully navigated to IMDb search page.")&lt;br&gt;
else:&lt;br&gt;
    print("Failed to navigate to IMDb search page.")&lt;/p&gt;

&lt;h1&gt;
  
  
  Close the browser session
&lt;/h1&gt;

&lt;p&gt;driver.quit()&lt;br&gt;
3) from selenium import webdriver&lt;br&gt;
from selenium.webdriver.common.by import By&lt;br&gt;
from selenium.webdriver.support.ui import WebDriverWait&lt;br&gt;
from selenium.webdriver.support import expected_conditions as EC&lt;/p&gt;

&lt;h1&gt;
  
  
  Initialize Chrome WebDriver
&lt;/h1&gt;

&lt;p&gt;driver = webdriver.Chrome()&lt;/p&gt;

&lt;h1&gt;
  
  
  Navigate to the webpage
&lt;/h1&gt;

&lt;p&gt;driver.get("&lt;a href="https://www.example.com%22"&gt;https://www.example.com"&lt;/a&gt;)  # Replace with the actual URL&lt;/p&gt;

&lt;p&gt;try:&lt;br&gt;
    # Define an explicit wait&lt;br&gt;
    wait = WebDriverWait(driver, 10)&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# Fill data in input boxes
input_box1 = wait.until(EC.visibility_of_element_located((By.ID, "input-box1")))
input_box1.send_keys("Data for input box 1")

input_box2 = wait.until(EC.visibility_of_element_located((By.ID, "input-box2")))
input_box2.send_keys("Data for input box 2")

# Select options in select boxes
select_box1 = wait.until(EC.visibility_of_element_located((By.ID, "select-box1")))
select_box1.select_by_visible_text("Option 1")

select_box2 = wait.until(EC.visibility_of_element_located((By.ID, "select-box2")))
select_box2.select_by_value("option2")

# Choose options in dropdown menus
dropdown_menu1 = wait.until(EC.visibility_of_element_located((By.ID, "dropdown-menu1")))
dropdown_menu1.click()
dropdown_menu1_option = wait.until(EC.visibility_of_element_located((By.XPATH, "//li[text()='Option 1']")))
dropdown_menu1_option.click()

dropdown_menu2 = wait.until(EC.visibility_of_element_located((By.ID, "dropdown-menu2")))
dropdown_menu2.click()
dropdown_menu2_option = wait.until(EC.visibility_of_element_located((By.XPATH, "//li[text()='Option 2']")))
dropdown_menu2_option.click()

# Perform a search
search_button = wait.until(EC.visibility_of_element_located((By.ID, "search-button")))
search_button.click()

print("Data filled in input boxes, select boxes, and dropdown menus. Search performed successfully.")
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;except Exception as e:&lt;br&gt;
    print(f"An error occurred: {e}")&lt;/p&gt;

&lt;p&gt;finally:&lt;br&gt;
    # Close the browser session&lt;br&gt;
    driver.quit()&lt;br&gt;
2) from selenium import webdriver&lt;br&gt;
from selenium.webdriver.common.by import By&lt;br&gt;
from selenium.webdriver.support.ui import WebDriverWait&lt;br&gt;
from selenium.webdriver.support import expected_conditions as EC&lt;/p&gt;

&lt;h1&gt;
  
  
  Initialize Chrome WebDriver
&lt;/h1&gt;

&lt;p&gt;driver = webdriver.Chrome()&lt;/p&gt;

&lt;h1&gt;
  
  
  Navigate to the webpage
&lt;/h1&gt;

&lt;p&gt;driver.get("&lt;a href="https://www.example.com%22"&gt;https://www.example.com"&lt;/a&gt;)  # Replace with the actual URL&lt;/p&gt;

&lt;p&gt;try:&lt;br&gt;
    # Define an explicit wait&lt;br&gt;
    wait = WebDriverWait(driver, 10)&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# Fill data in input boxes
input_box1 = wait.until(EC.visibility_of_element_located((By.ID, "input-box1")))
input_box1.send_keys("Data for input box 1")

input_box2 = wait.until(EC.visibility_of_element_located((By.ID, "input-box2")))
input_box2.send_keys("Data for input box 2")

# Select options in select boxes
select_box1 = wait.until(EC.visibility_of_element_located((By.ID, "select-box1")))
select_box1.select_by_visible_text("Option 1")

select_box2 = wait.until(EC.visibility_of_element_located((By.ID, "select-box2")))
select_box2.select_by_value("option2")

# Choose options in dropdown menus
dropdown_menu1 = wait.until(EC.visibility_of_element_located((By.ID, "dropdown-menu1")))
dropdown_menu1.click()
dropdown_menu1_option = wait.until(EC.visibility_of_element_located((By.XPATH, "//li[text()='Option 1']")))
dropdown_menu1_option.click()

dropdown_menu2 = wait.until(EC.visibility_of_element_located((By.ID, "dropdown-menu2")))
dropdown_menu2.click()
dropdown_menu2_option = wait.until(EC.visibility_of_element_located((By.XPATH, "//li[text()='Option 2']")))
dropdown_menu2_option.click()

# Perform a search
search_button = wait.until(EC.visibility_of_element_located((By.ID, "search-button")))
search_button.click()

print("Data filled in input boxes, select boxes, and dropdown menus. Search performed successfully.")
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;except Exception as e:&lt;br&gt;
    print(f"An error occurred: {e}")&lt;/p&gt;

&lt;p&gt;finally:&lt;br&gt;
    # Close the browser session&lt;br&gt;
    driver.quit()&lt;br&gt;
3) from selenium import webdriver&lt;br&gt;
from selenium.webdriver.common.by import By&lt;br&gt;
from selenium.webdriver.support.ui import WebDriverWait&lt;br&gt;
from selenium.webdriver.support import expected_conditions as EC&lt;/p&gt;

&lt;h1&gt;
  
  
  Initialize Chrome WebDriver
&lt;/h1&gt;

&lt;p&gt;driver = webdriver.Chrome()&lt;/p&gt;

&lt;h1&gt;
  
  
  Navigate to the webpage
&lt;/h1&gt;

&lt;p&gt;driver.get("&lt;a href="https://www.example.com%22"&gt;https://www.example.com"&lt;/a&gt;)  # Replace with the actual URL&lt;/p&gt;

&lt;p&gt;try:&lt;br&gt;
    # Define an explicit wait&lt;br&gt;
    wait = WebDriverWait(driver, 10)&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# Fill data in input boxes
input_box1 = wait.until(EC.visibility_of_element_located((By.ID, "input-box1")))
input_box1.send_keys("Data for input box 1")

input_box2 = wait.until(EC.visibility_of_element_located((By.ID, "input-box2")))
input_box2.send_keys("Data for input box 2")

# Select options in select boxes
select_box1 = wait.until(EC.element_to_be_clickable((By.ID, "select-box1")))
select_box1.click()
option1 = wait.until(EC.visibility_of_element_located((By.XPATH, "//option[text()='Option 1']")))
option1.click()

select_box2 = wait.until(EC.element_to_be_clickable((By.ID, "select-box2")))
select_box2.click()
option2 = wait.until(EC.visibility_of_element_located((By.XPATH, "//option[text()='Option 2']")))
option2.click()

# Choose options in dropdown menus
dropdown_menu1 = wait.until(EC.element_to_be_clickable((By.ID, "dropdown-menu1")))
dropdown_menu1.click()
dropdown_menu1_option = wait.until(EC.visibility_of_element_located((By.XPATH, "//li[text()='Option 1']")))
dropdown_menu1_option.click()

dropdown_menu2 = wait.until(EC.element_to_be_clickable((By.ID, "dropdown-menu2")))
dropdown_menu2.click()
dropdown_menu2_option = wait.until(EC.visibility_of_element_located((By.XPATH, "//li[text()='Option 2']")))
dropdown_menu2_option.click()

# Perform a search
search_button = wait.until(EC.element_to_be_clickable((By.ID, "search-button")))
search_button.click()

print("Data filled in input boxes, select boxes, and dropdown menus. Search performed successfully.")
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;except Exception as e:&lt;br&gt;
    print(f"An error occurred: {e}")&lt;/p&gt;

&lt;p&gt;finally:&lt;br&gt;
    # Close the browser session&lt;br&gt;
    driver.quit()&lt;/p&gt;

</description>
    </item>
    <item>
      <title>task 20</title>
      <dc:creator>ABUL HASAN A</dc:creator>
      <pubDate>Thu, 30 May 2024 17:34:31 +0000</pubDate>
      <link>https://dev.to/abul_4693/task-20-44ho</link>
      <guid>https://dev.to/abul_4693/task-20-44ho</guid>
      <description>&lt;p&gt;1) from selenium import webdriver&lt;br&gt;
from selenium.webdriver.common.by import By&lt;br&gt;
from selenium.webdriver.common.keys import Keys&lt;br&gt;
import time&lt;/p&gt;

&lt;h1&gt;
  
  
  Start a new browser session
&lt;/h1&gt;

&lt;p&gt;driver = webdriver.Chrome()&lt;/p&gt;

&lt;p&gt;try:&lt;br&gt;
    # Open the CoWIN website&lt;br&gt;
    driver.get("&lt;a href="https://www.cowin.gov.in/%22"&gt;https://www.cowin.gov.in/"&lt;/a&gt;)&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# Wait for the page to load
time.sleep(2)

# Locate the "FAQ" anchor tag and click on it to open in a new window
faq_link = driver.find_element(By.XPATH, "//a[contains(text(),'FAQ')]")
faq_link.send_keys(Keys.CONTROL + Keys.RETURN)

# Switch to the newly opened window
driver.switch_to.window(driver.window_handles[1])

# Wait for the new page to load
time.sleep(2)

# Locate the "Partners" anchor tag and click on it to open in a new window
partners_link = driver.find_element(By.XPATH, "//a[contains(text(),'Partners')]")
partners_link.send_keys(Keys.CONTROL + Keys.RETURN)

# Switch to the newly opened window
driver.switch_to.window(driver.window_handles[2])

# Wait for the new page to load
time.sleep(2)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;finally:&lt;br&gt;
    # Close all windows&lt;br&gt;
    driver.quit()&lt;br&gt;
2) from selenium import webdriver&lt;br&gt;
import time&lt;/p&gt;

&lt;h1&gt;
  
  
  Start a new browser session
&lt;/h1&gt;

&lt;p&gt;driver = webdriver.Chrome()&lt;/p&gt;

&lt;p&gt;try:&lt;br&gt;
    # Open the CoWIN website&lt;br&gt;
    driver.get("&lt;a href="https://www.cowin.gov.in/%22"&gt;https://www.cowin.gov.in/"&lt;/a&gt;)&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# Wait for the page to load
time.sleep(2)

# Locate the "FAQ" anchor tag and click on it to open in a new window
faq_link = driver.find_element_by_xpath("//a[contains(text(),'FAQ')]")
faq_link.click()

# Wait for the new window to open
time.sleep(2)

# Fetch and display the opened window handles
window_handles = driver.window_handles
print("Opened Windows / Frame IDs:")
for handle in window_handles:
    print(handle)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;finally:&lt;br&gt;
    # Close the browser session&lt;br&gt;
    driver.quit()&lt;br&gt;
3) from selenium import webdriver&lt;br&gt;
import time&lt;/p&gt;

&lt;h1&gt;
  
  
  Start a new browser session
&lt;/h1&gt;

&lt;p&gt;driver = webdriver.Chrome()&lt;/p&gt;

&lt;p&gt;try:&lt;br&gt;
    # Open the CoWIN website&lt;br&gt;
    driver.get("&lt;a href="https://www.cowin.gov.in/%22"&gt;https://www.cowin.gov.in/"&lt;/a&gt;)&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# Wait for the page to load
time.sleep(2)

# Locate the "FAQ" anchor tag and click on it to open in a new window
faq_link = driver.find_element_by_xpath("//a[contains(text(),'FAQ')]")
faq_link.click()

# Wait for the new window to open
time.sleep(2)

# Fetch the opened window handles
window_handles = driver.window_handles

# Switch to the newly opened window
driver.switch_to.window(window_handles[1])

# Close the FAQ window
driver.close()

# Switch back to the home page window
driver.switch_to.window(window_handles[0])

# Wait for a brief period
time.sleep(2)

# Locate the "Partners" anchor tag and click on it to open in a new window
partners_link = driver.find_element_by_xpath("//a[contains(text(),'Partners')]")
partners_link.click()

# Wait for the new window to open
time.sleep(2)

# Fetch the opened window handles
window_handles = driver.window_handles

# Switch to the newly opened window
driver.switch_to.window(window_handles[1])

# Close the Partners window
driver.close()

# Switch back to the home page window
driver.switch_to.window(window_handles[0])
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;finally:&lt;br&gt;
    # Close the browser session&lt;br&gt;
    driver.quit()&lt;/p&gt;

</description>
    </item>
    <item>
      <title>task 7</title>
      <dc:creator>ABUL HASAN A</dc:creator>
      <pubDate>Thu, 30 May 2024 17:21:04 +0000</pubDate>
      <link>https://dev.to/abul_4693/task-7-k7b</link>
      <guid>https://dev.to/abul_4693/task-7-k7b</guid>
      <description>&lt;p&gt;1) import requests&lt;/p&gt;

&lt;p&gt;class Country:&lt;br&gt;
    def &lt;strong&gt;init&lt;/strong&gt;(self, name, capital, population, area, languages):&lt;br&gt;
        self.name = name&lt;br&gt;
        self.capital = capital&lt;br&gt;
        self.population = population&lt;br&gt;
        self.area = area&lt;br&gt;
        self.languages = languages&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;def display_info(self):
    print(f"Country: {self.name}")
    print(f"Capital: {self.capital}")
    print(f"Population: {self.population}")
    print(f"Area: {self.area} square kilometers")
    print("Languages:")
    for lang in self.languages:
        print(f"- {lang}")
    print()
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;class CountryInfoFetcher:&lt;br&gt;
    def fetch_countries_info(self):&lt;br&gt;
        try:&lt;br&gt;
            response = requests.get("&lt;a href="https://restcountries.com/v3.1/all%22"&gt;https://restcountries.com/v3.1/all"&lt;/a&gt;)&lt;br&gt;
            data = response.json()&lt;br&gt;
            return data&lt;br&gt;
        except requests.RequestException as e:&lt;br&gt;
            print("Error fetching country information:", e)&lt;br&gt;
            return []&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;def display_countries_info(self, countries):
    for country_data in countries:
        country = self.create_country_object(country_data)
        country.display_info()

def create_country_object(self, country_data):
    name = country_data.get("name", "N/A")
    capital = country_data.get("capital", "N/A")
    population = country_data.get("population", "N/A")
    area = country_data.get("area", "N/A")
    languages = country_data.get("languages", [])
    return Country(name, capital, population, area, languages)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;if &lt;strong&gt;name&lt;/strong&gt; == "&lt;strong&gt;main&lt;/strong&gt;":&lt;br&gt;
    info_fetcher = CountryInfoFetcher()&lt;br&gt;
    countries_info = info_fetcher.fetch_countries_info()&lt;br&gt;
    info_fetcher.display_countries_info(countries_info)&lt;br&gt;
2)import requests&lt;/p&gt;

&lt;p&gt;class CountryInfoFetcher:&lt;br&gt;
    def &lt;strong&gt;init&lt;/strong&gt;(self, url):&lt;br&gt;
        self.url = url&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;def fetch_countries_info(self):
    try:
        response = requests.get(self.url)
        data = response.json()
        return data
    except requests.RequestException as e:
        print("Error fetching country information:", e)
        return []

def display_countries_info(self, countries):
    for country_data in countries:
        self.display_country_info(country_data)

def display_country_info(self, country_data):
    name = country_data.get("name", "N/A")
    capital = country_data.get("capital", "N/A")
    population = country_data.get("population", "N/A")
    area = country_data.get("area", "N/A")
    languages = country_data.get("languages", [])
    print(f"Country: {name}")
    print(f"Capital: {capital}")
    print(f"Population: {population}")
    print(f"Area: {area} square kilometers")
    print("Languages:")
    for lang in languages:
        print(f"- {lang}")
    print()
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;if &lt;strong&gt;name&lt;/strong&gt; == "&lt;strong&gt;main&lt;/strong&gt;":&lt;br&gt;
    url = "&lt;a href="https://restcountries.com/v3.1/all"&gt;https://restcountries.com/v3.1/all&lt;/a&gt;"&lt;br&gt;
    info_fetcher = CountryInfoFetcher(url)&lt;br&gt;
    countries_info = info_fetcher.fetch_countries_info()&lt;br&gt;
    info_fetcher.display_countries_info(countries_info)&lt;br&gt;
3)import requests&lt;/p&gt;

&lt;p&gt;class CountryInfoFetcher:&lt;br&gt;
    def &lt;strong&gt;init&lt;/strong&gt;(self, url):&lt;br&gt;
        self.url = url&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;def fetch_json_data(self):
    try:
        response = requests.get(self.url)
        data = response.json()
        return data
    except requests.RequestException as e:
        print("Error fetching JSON data:", e)
        return None
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;if &lt;strong&gt;name&lt;/strong&gt; == "&lt;strong&gt;main&lt;/strong&gt;":&lt;br&gt;
    url = "&lt;a href="https://restcountries.com/v3.1/all"&gt;https://restcountries.com/v3.1/all&lt;/a&gt;"&lt;br&gt;
    info_fetcher = CountryInfoFetcher(url)&lt;br&gt;
    json_data = info_fetcher.fetch_json_data()&lt;br&gt;
    if json_data:&lt;br&gt;
        print(json_data)&lt;br&gt;
4) import requests&lt;/p&gt;

&lt;p&gt;class CountryInfoFetcher:&lt;br&gt;
    def &lt;strong&gt;init&lt;/strong&gt;(self, url):&lt;br&gt;
        self.url = url&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;def fetch_countries_info(self):
    try:
        response = requests.get(self.url)
        data = response.json()
        return data
    except requests.RequestException as e:
        print("Error fetching country information:", e)
        return None

def display_country_info(self, countries):
    for country_data in countries:
        name = country_data.get("name", "N/A")
        currencies = country_data.get("currencies", [])
        currency_symbols = [currency.get("symbol", "N/A") for currency in currencies]
        print(f"Country: {name}")
        print("Currency Symbols:", ", ".join(currency_symbols))
        print()
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;if &lt;strong&gt;name&lt;/strong&gt; == "&lt;strong&gt;main&lt;/strong&gt;":&lt;br&gt;
    url = "&lt;a href="https://restcountries.com/v3.1/all"&gt;https://restcountries.com/v3.1/all&lt;/a&gt;"&lt;br&gt;
    info_fetcher = CountryInfoFetcher(url)&lt;br&gt;
    countries_info = info_fetcher.fetch_countries_info()&lt;br&gt;
    if countries_info:&lt;br&gt;
        info_fetcher.display_country_info(countries_info)&lt;br&gt;
5)import requests&lt;/p&gt;

&lt;p&gt;class CountryInfoFetcher:&lt;br&gt;
    def &lt;strong&gt;init&lt;/strong&gt;(self, url):&lt;br&gt;
        self.url = url&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;def fetch_countries_info(self):
    try:
        response = requests.get(self.url)
        data = response.json()
        return data
    except requests.RequestException as e:
        print("Error fetching country information:", e)
        return None

def display_countries_with_dollar_currency(self, countries):
    dollar_countries = []
    for country_data in countries:
        name = country_data.get("name", "N/A")
        currencies = country_data.get("currencies", [])
        currency_names = [currency.get("name", "") for currency in currencies]
        if "DOLLAR" in currency_names:
            dollar_countries.append(name)
    if dollar_countries:
        print("Countries with DOLLAR as currency:")
        for country in dollar_countries:
            print(country)
    else:
        print("No countries found with DOLLAR as currency.")
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;if &lt;strong&gt;name&lt;/strong&gt; == "&lt;strong&gt;main&lt;/strong&gt;":&lt;br&gt;
    url = "&lt;a href="https://restcountries.com/v3.1/all"&gt;https://restcountries.com/v3.1/all&lt;/a&gt;"&lt;br&gt;
    info_fetcher = CountryInfoFetcher(url)&lt;br&gt;
    countries_info = info_fetcher.fetch_countries_info()&lt;br&gt;
    if countries_info:&lt;br&gt;
        info_fetcher.display_countries_with_dollar_currency(countries_info)&lt;br&gt;
6) import requests&lt;/p&gt;

&lt;p&gt;class CountryInfoFetcher:&lt;br&gt;
    def &lt;strong&gt;init&lt;/strong&gt;(self, url):&lt;br&gt;
        self.url = url&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;def fetch_countries_info(self):
    try:
        response = requests.get(self.url)
        data = response.json()
        return data
    except requests.RequestException as e:
        print("Error fetching country information:", e)
        return None

def display_countries_with_euro_currency(self, countries):
    euro_countries = []
    for country_data in countries:
        name = country_data.get("name", "N/A")
        currencies = country_data.get("currencies", [])
        for currency in currencies:
            if "code" in currency and currency["code"] == "EUR":
                euro_countries.append(name)
                break
    if euro_countries:
        print("Countries with EURO as currency:")
        for country in euro_countries:
            print(country)
    else:
        print("No countries found with EURO as currency.")
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;if &lt;strong&gt;name&lt;/strong&gt; == "&lt;strong&gt;main&lt;/strong&gt;":&lt;br&gt;
    url = "&lt;a href="https://restcountries.com/v3.1/all"&gt;https://restcountries.com/v3.1/all&lt;/a&gt;"&lt;br&gt;
    info_fetcher = CountryInfoFetcher(url)&lt;br&gt;
    countries_info = info_fetcher.fetch_countries_info()&lt;br&gt;
    if countries_info:&lt;br&gt;
        info_fetcher.display_countries_with_euro_currency(countries_info)&lt;br&gt;
B) &lt;br&gt;
1)import requests&lt;/p&gt;

&lt;p&gt;class CountryInfoFetcher:&lt;br&gt;
    def &lt;strong&gt;init&lt;/strong&gt;(self, url):&lt;br&gt;
        self.url = url&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;def fetch_countries_info(self):
    try:
        response = requests.get(self.url)
        data = response.json()
        return data
    except requests.RequestException as e:
        print("Error fetching country information:", e)
        return None

def display_countries_with_euro_currency(self, countries):
    euro_countries = []
    for country_data in countries:
        name = country_data.get("name", "N/A")
        currencies = country_data.get("currencies", [])
        for currency in currencies:
            if "code" in currency and currency["code"] == "EUR":
                euro_countries.append(name)
                break
    if euro_countries:
        print("Countries with EURO as currency:")
        for country in euro_countries:
            print(country)
    else:
        print("No countries found with EURO as currency.")
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;if &lt;strong&gt;name&lt;/strong&gt; == "&lt;strong&gt;main&lt;/strong&gt;":&lt;br&gt;
    url = "&lt;a href="https://restcountries.com/v3.1/all"&gt;https://restcountries.com/v3.1/all&lt;/a&gt;"&lt;br&gt;
    info_fetcher = CountryInfoFetcher(url)&lt;br&gt;
    countries_info = info_fetcher.fetch_countries_info()&lt;br&gt;
    if countries_info:&lt;br&gt;
        info_fetcher.display_countries_with_euro_currency(countries_info)&lt;br&gt;
2) import requests&lt;/p&gt;

&lt;p&gt;def fetch_breweries_by_state(state):&lt;br&gt;
    url = f"&lt;a href="https://api.openbrewerydb.org/breweries?by_state=%7Bstate%7D&amp;amp;per_page=50"&gt;https://api.openbrewerydb.org/breweries?by_state={state}&amp;amp;per_page=50&lt;/a&gt;"&lt;br&gt;
    response = requests.get(url)&lt;br&gt;
    if response.status_code == 200:&lt;br&gt;
        return response.json()&lt;br&gt;
    else:&lt;br&gt;
        print(f"Failed to fetch breweries for {state}.")&lt;br&gt;
        return []&lt;/p&gt;

&lt;p&gt;def count_breweries_in_states(states):&lt;br&gt;
    for state in states:&lt;br&gt;
        breweries = fetch_breweries_by_state(state)&lt;br&gt;
        brewery_count = len(breweries)&lt;br&gt;
        print(f"Number of breweries in {state}: {brewery_count}")&lt;/p&gt;

&lt;p&gt;if &lt;strong&gt;name&lt;/strong&gt; == "&lt;strong&gt;main&lt;/strong&gt;":&lt;br&gt;
    states = ['Alaska', 'Maine', 'New York']&lt;br&gt;
    count_breweries_in_states(states)&lt;br&gt;
3) import requests&lt;/p&gt;

&lt;p&gt;def fetch_breweries_by_state_and_city(state, city):&lt;br&gt;
    url = f"&lt;a href="https://api.openbrewerydb.org/breweries?by_state=%7Bstate%7D&amp;amp;by_city=%7Bcity%7D&amp;amp;per_page=50"&gt;https://api.openbrewerydb.org/breweries?by_state={state}&amp;amp;by_city={city}&amp;amp;per_page=50&lt;/a&gt;"&lt;br&gt;
    response = requests.get(url)&lt;br&gt;
    if response.status_code == 200:&lt;br&gt;
        return response.json()&lt;br&gt;
    else:&lt;br&gt;
        print(f"Failed to fetch breweries for {city}, {state}.")&lt;br&gt;
        return []&lt;/p&gt;

&lt;p&gt;def count_brewery_types_in_cities(states):&lt;br&gt;
    for state in states:&lt;br&gt;
        print(f"State: {state}")&lt;br&gt;
        cities = set()&lt;br&gt;
        breweries_count = 0&lt;br&gt;
        breweries_by_city = {}&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    # Fetch breweries for the state
    breweries = fetch_breweries_by_state_and_city(state, "")

    # Count the number of types of breweries in each city
    for brewery in breweries:
        city = brewery.get('city', 'Unknown')
        if city not in cities:
            cities.add(city)
            breweries_by_city[city] = set()
        brewery_type = brewery.get('brewery_type', 'Unknown')
        breweries_by_city[city].add(brewery_type)
        breweries_count += 1

    # Print the count of types of breweries in each city
    for city, types in breweries_by_city.items():
        print(f"City: {city}, Number of Brewery Types: {len(types)}")
    print(f"Total Breweries in {state}: {breweries_count}")
    print()
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;if &lt;strong&gt;name&lt;/strong&gt; == "&lt;strong&gt;main&lt;/strong&gt;":&lt;br&gt;
    states = ['Alaska', 'Maine', 'New York']&lt;br&gt;
    count_brewery_types_in_cities(states)&lt;br&gt;
4)import requests&lt;/p&gt;

&lt;p&gt;def fetch_breweries_by_state(state):&lt;br&gt;
    url = f"&lt;a href="https://api.openbrewerydb.org/breweries?by_state=%7Bstate%7D&amp;amp;per_page=50"&gt;https://api.openbrewerydb.org/breweries?by_state={state}&amp;amp;per_page=50&lt;/a&gt;"&lt;br&gt;
    response = requests.get(url)&lt;br&gt;
    if response.status_code == 200:&lt;br&gt;
        return response.json()&lt;br&gt;
    else:&lt;br&gt;
        print(f"Failed to fetch breweries for {state}.")&lt;br&gt;
        return []&lt;/p&gt;

&lt;p&gt;def count_and_list_breweries_with_websites_in_states(states):&lt;br&gt;
    for state in states:&lt;br&gt;
        print(f"State: {state}")&lt;br&gt;
        breweries = fetch_breweries_by_state(state)&lt;br&gt;
        breweries_with_websites = [brewery for brewery in breweries if brewery.get('website_url')]&lt;br&gt;
        brewery_count_with_websites = len(breweries_with_websites)&lt;br&gt;
        print(f"Number of Breweries with Websites in {state}: {brewery_count_with_websites}")&lt;br&gt;
        if breweries_with_websites:&lt;br&gt;
            print("Breweries with Websites:")&lt;br&gt;
            for brewery in breweries_with_websites:&lt;br&gt;
                print("-", brewery['name'])&lt;br&gt;
        print()&lt;/p&gt;

&lt;p&gt;if &lt;strong&gt;name&lt;/strong&gt; == "&lt;strong&gt;main&lt;/strong&gt;":&lt;br&gt;
    states = ['Alaska', 'Maine', 'New York']&lt;br&gt;
    count_and_list_breweries_with_websites_in_states(states)&lt;/p&gt;

</description>
    </item>
    <item>
      <title>task 11</title>
      <dc:creator>ABUL HASAN A</dc:creator>
      <pubDate>Thu, 30 May 2024 17:00:09 +0000</pubDate>
      <link>https://dev.to/abul_4693/task-11-1l5b</link>
      <guid>https://dev.to/abul_4693/task-11-1l5b</guid>
      <description>&lt;p&gt;from selenium import webdriver&lt;br&gt;
from selenium.webdriver.common.action_chains import ActionChains&lt;br&gt;
from selenium.webdriver.common.by import By&lt;br&gt;
import time&lt;/p&gt;

&lt;h1&gt;
  
  
  Start a new browser session
&lt;/h1&gt;

&lt;p&gt;driver = webdriver.Chrome()&lt;/p&gt;

&lt;p&gt;try:&lt;br&gt;
    # Open the URL&lt;br&gt;
    driver.get("&lt;a href="https://jqueryui.com/droppable/%22"&gt;https://jqueryui.com/droppable/"&lt;/a&gt;)&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# Switch to the iframe containing the draggable elements
iframe = driver.find_element(By.CLASS_NAME, "demo-frame")
driver.switch_to.frame(iframe)

# Locate the draggable element
draggable_element = driver.find_element(By.ID, "draggable")

# Locate the droppable element
droppable_element = driver.find_element(By.ID, "droppable")

# Perform the drag and drop operation
actions = ActionChains(driver)
actions.drag_and_drop(draggable_element, droppable_element).perform()

# Wait for a few seconds to see the result
time.sleep(2)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;finally:&lt;br&gt;
    # Close the browser&lt;br&gt;
    driver.quit()&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F9vi9eg8gk0r3qmmy75g4.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F9vi9eg8gk0r3qmmy75g4.jpeg" alt="Image description" width="800" height="545"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>task 10</title>
      <dc:creator>ABUL HASAN A</dc:creator>
      <pubDate>Thu, 30 May 2024 16:47:10 +0000</pubDate>
      <link>https://dev.to/abul_4693/task-10-4jfe</link>
      <guid>https://dev.to/abul_4693/task-10-4jfe</guid>
      <description>&lt;p&gt;1)from selenium import webdriver&lt;br&gt;
from selenium.webdriver.common.by import By&lt;/p&gt;

&lt;h1&gt;
  
  
  Start a new browser session
&lt;/h1&gt;

&lt;p&gt;driver = webdriver.Chrome()&lt;/p&gt;

&lt;p&gt;try:&lt;br&gt;
    # Open the Instagram page&lt;br&gt;
    driver.get("&lt;a href="https://www.instagram.com/guviofficial/%22"&gt;https://www.instagram.com/guviofficial/"&lt;/a&gt;)&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# Wait for the page to load
driver.implicitly_wait(10)  # Wait for 10 seconds for elements to appear

# Extract the number of posts
post_count_element = driver.find_element(By.XPATH, '//span[text()="posts"]/span')
post_count = post_count_element.text
print("Number of posts:", post_count)

# Extract the number of followers
follower_count_element = driver.find_element(By.XPATH, '//span[@title="Followers"]/span')
follower_count = follower_count_element.get_attribute("title")
print("Number of followers:", follower_count)

# Extract the number of following
following_count_element = driver.find_element(By.XPATH, '//span[@title="Following"]/span')
following_count = following_count_element.get_attribute("title")
print("Number of following:", following_count)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;finally:&lt;br&gt;
    # Close the browser&lt;br&gt;
    driver.quit()&lt;br&gt;
2) from selenium import webdriver&lt;br&gt;
from selenium.webdriver.common.by import By&lt;/p&gt;

&lt;h1&gt;
  
  
  Start a new browser session
&lt;/h1&gt;

&lt;p&gt;driver = webdriver.Chrome()&lt;/p&gt;

&lt;p&gt;try:&lt;br&gt;
    # Open the Instagram profile page&lt;br&gt;
    driver.get("&lt;a href="https://www.instagram.com/guviofficial/%22"&gt;https://www.instagram.com/guviofficial/"&lt;/a&gt;)&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# Wait for the page to load
driver.implicitly_wait(10)  # Wait for 10 seconds for elements to appear

# Extract the number of followers
followers_element = driver.find_element(By.XPATH, '//a[@href="/guviofficial/followers/"]/span')
followers_count = followers_element.get_attribute("title")
print("Followers:", followers_count)

# Extract the number of following
following_element = driver.find_element(By.XPATH, '//a[@href="/guviofficial/following/"]/span')
following_count = following_element.get_attribute("title")
print("Following:", following_count)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;finally:&lt;br&gt;
    # Close the browser&lt;br&gt;
    driver.quit()&lt;/p&gt;

</description>
    </item>
    <item>
      <title>task 21</title>
      <dc:creator>ABUL HASAN A</dc:creator>
      <pubDate>Thu, 30 May 2024 16:40:03 +0000</pubDate>
      <link>https://dev.to/abul_4693/task-21-2n8p</link>
      <guid>https://dev.to/abul_4693/task-21-2n8p</guid>
      <description>&lt;p&gt;from selenium import webdriver&lt;br&gt;
from selenium.webdriver.common.by import By&lt;br&gt;
from selenium.webdriver.common.keys import Keys&lt;br&gt;
import time&lt;/p&gt;

&lt;h1&gt;
  
  
  Function to display cookies
&lt;/h1&gt;

&lt;p&gt;def display_cookies(driver):&lt;br&gt;
    cookies = driver.get_cookies()&lt;br&gt;
    print("Cookies:")&lt;br&gt;
    for cookie in cookies:&lt;br&gt;
        print(cookie)&lt;/p&gt;

&lt;h1&gt;
  
  
  URL and login credentials
&lt;/h1&gt;

&lt;p&gt;url = "&lt;a href="https://www.saucedemo.com/"&gt;https://www.saucedemo.com/&lt;/a&gt;"&lt;br&gt;
username = "standard_user"&lt;br&gt;
password = "secret_sauce"&lt;/p&gt;

&lt;h1&gt;
  
  
  Start a new browser session
&lt;/h1&gt;

&lt;p&gt;driver = webdriver.Chrome()&lt;/p&gt;

&lt;p&gt;try:&lt;br&gt;
    # Open the URL&lt;br&gt;
    driver.get(url)&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# Display cookies before login
print("Before login:")
display_cookies(driver)

# Login
username_field = driver.find_element(By.ID, "user-name")
username_field.send_keys(username)
password_field = driver.find_element(By.ID, "password")
password_field.send_keys(password)
login_button = driver.find_element(By.ID, "login-button")
login_button.click()

# Display cookies after login
print("After login:")
display_cookies(driver)

# Logout
logout_button = driver.find_element(By.ID, "logout_sidebar_link")
logout_button.click()
print("Logged out successfully.")
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;finally:&lt;br&gt;
    # Close the browser&lt;br&gt;
    driver.quit()&lt;/p&gt;

</description>
    </item>
    <item>
      <title>task 18</title>
      <dc:creator>ABUL HASAN A</dc:creator>
      <pubDate>Thu, 30 May 2024 15:02:06 +0000</pubDate>
      <link>https://dev.to/abul_4693/task-18-542g</link>
      <guid>https://dev.to/abul_4693/task-18-542g</guid>
      <description>&lt;p&gt;1) Selenium is a popular open-source tool primarily used for automating web browsers. It enables users to simulate user interactions with web applications, such as clicking buttons, filling forms, navigating pages, and extracting data. Below, I'll describe the architecture of Selenium in detail:&lt;/p&gt;

&lt;p&gt;Selenium WebDriver:&lt;/p&gt;

&lt;p&gt;At the core of Selenium is the WebDriver, which provides an API to interact with web browsers.&lt;br&gt;
WebDriver communicates directly with the browser through its native support (like ChromeDriver for Chrome, GeckoDriver for Firefox, etc.).&lt;br&gt;
It sends commands to the browser and receives results using a browser-specific protocol, allowing automation of user actions.&lt;br&gt;
Client Libraries:&lt;/p&gt;

&lt;p&gt;Selenium supports various programming languages like Python, Java, JavaScript, C#, Ruby, etc.&lt;br&gt;
Client libraries provide language-specific bindings to interact with the WebDriver API.&lt;br&gt;
For Python, the selenium package provides the necessary bindings.&lt;br&gt;
Selenium Grid:&lt;/p&gt;

&lt;p&gt;Selenium Grid extends the capabilities of WebDriver by allowing parallel execution of tests across multiple browsers and platforms.&lt;br&gt;
It consists of a hub and multiple nodes.&lt;br&gt;
The hub manages test sessions and distributes them to the nodes.&lt;br&gt;
Nodes are individual machines or VMs that run tests in parallel on different browsers and platforms.&lt;br&gt;
Browser Drivers:&lt;/p&gt;

&lt;p&gt;Browser drivers are executables provided by Selenium to control specific browsers.&lt;br&gt;
Each browser (Chrome, Firefox, Edge, etc.) requires its own driver.&lt;br&gt;
These drivers act as intermediaries between the WebDriver API and the browser's native functionality.&lt;br&gt;
They facilitate interactions like clicking elements, filling forms, etc., by translating WebDriver commands into actions that the browser understands.&lt;br&gt;
JSON Wire Protocol:&lt;/p&gt;

&lt;p&gt;JSON Wire Protocol is a RESTful API used for communication between the WebDriver and the browser.&lt;br&gt;
It defines a set of endpoints and commands that WebDriver uses to control the browser and retrieve information.&lt;br&gt;
WebDriver libraries serialize commands into JSON format and send them to the browser via HTTP.&lt;br&gt;
The browser executes the commands and sends back the results as JSON responses.&lt;br&gt;
Execution Flow:&lt;/p&gt;

&lt;p&gt;The test script written using Selenium WebDriver API interacts with the browser through the client library.&lt;br&gt;
WebDriver translates these commands into HTTP requests and forwards them to the browser driver.&lt;br&gt;
The browser driver executes the commands in the browser and sends back the results to the client.&lt;br&gt;
The client library receives the responses and processes them accordingly, enabling automated testing and interaction with web applications.&lt;br&gt;
2) A Python Virtual Environment is a self-contained directory tree that contains a Python installation for a particular version of Python, plus a number of additional packages. It allows you to work on a specific project without affecting the system-wide Python installation or other projects. Here are some key purposes and examples of using Python Virtual Environments:&lt;/p&gt;

&lt;p&gt;Isolation:&lt;/p&gt;

&lt;p&gt;Virtual Environments isolate project dependencies from each other and from the system-wide Python installation.&lt;br&gt;
This prevents conflicts between different versions of packages required by different projects.&lt;br&gt;
Dependency Management:&lt;/p&gt;

&lt;p&gt;Virtual Environments allow you to specify and manage project-specific dependencies independently of other projects.&lt;br&gt;
You can install, upgrade, or remove packages within the virtual environment without affecting other projects.&lt;br&gt;
Reproducibility:&lt;/p&gt;

&lt;p&gt;Virtual Environments ensure that you can reproduce the exact environment (Python version and dependencies) required for a project.&lt;br&gt;
This facilitates collaboration and ensures consistency between development and production environments.&lt;br&gt;
Testing and Development:&lt;/p&gt;

&lt;p&gt;Virtual Environments provide a clean environment for testing and development.&lt;br&gt;
You can experiment with different package versions or configurations without worrying about breaking other projects.&lt;br&gt;
Ease of Deployment:&lt;/p&gt;

&lt;p&gt;Virtual Environments make it easier to deploy projects by encapsulating all dependencies in a single directory.&lt;br&gt;
You can distribute the virtual environment along with the project, ensuring that others can set up and run the project easily.&lt;br&gt;
Examples of using Python Virtual Environments:&lt;/p&gt;

&lt;p&gt;Creating a Virtual Environment:&lt;/p&gt;

&lt;h1&gt;
  
  
  Create a virtual environment named 'myenv'
&lt;/h1&gt;

&lt;p&gt;python3 -m venv myenv&lt;br&gt;
Activating a Virtual Environment:&lt;/p&gt;

&lt;h1&gt;
  
  
  On Windows
&lt;/h1&gt;

&lt;p&gt;myenv\Scripts\activate&lt;/p&gt;

&lt;h1&gt;
  
  
  On Unix or MacOS
&lt;/h1&gt;

&lt;p&gt;source myenv/bin/activate&lt;br&gt;
Installing Packages:&lt;/p&gt;

&lt;h1&gt;
  
  
  Install a package using pip
&lt;/h1&gt;

&lt;p&gt;pip install package_name&lt;br&gt;
Freezing Dependencies:&lt;/p&gt;

&lt;h1&gt;
  
  
  Generate a requirements.txt file containing project dependencies
&lt;/h1&gt;

&lt;p&gt;pip freeze &amp;gt; requirements.txt&lt;br&gt;
Deactivating a Virtual Environment:&lt;br&gt;
deactivate&lt;/p&gt;

</description>
    </item>
    <item>
      <title>TASK 9</title>
      <dc:creator>ABUL HASAN A</dc:creator>
      <pubDate>Thu, 30 May 2024 14:53:19 +0000</pubDate>
      <link>https://dev.to/abul_4693/task-9-27dm</link>
      <guid>https://dev.to/abul_4693/task-9-27dm</guid>
      <description>&lt;p&gt;1) [10, 501, 22, 37, 100, 999, 87, 351]&lt;br&gt;
2)# Sample list containing a mix of integers and strings&lt;br&gt;
my_list = [10, 'hello', 5, 'world', 8]&lt;/p&gt;

&lt;h1&gt;
  
  
  Lambda function to check if an element is an integer or string
&lt;/h1&gt;

&lt;p&gt;check_type = lambda x: isinstance(x, (int, str))&lt;/p&gt;

&lt;h1&gt;
  
  
  Apply the lambda function to each element of the list
&lt;/h1&gt;

&lt;p&gt;result = list(map(check_type, my_list))&lt;/p&gt;

&lt;h1&gt;
  
  
  Print the result
&lt;/h1&gt;

&lt;p&gt;print(result)&lt;br&gt;
3)from functools import reduce&lt;/p&gt;

&lt;h1&gt;
  
  
  Define a lambda function to generate Fibonacci series
&lt;/h1&gt;

&lt;p&gt;fib_series = lambda n: reduce(lambda x, _: x + [x[-1] + x[-2]], range(n - 2), [0, 1])&lt;/p&gt;

&lt;h1&gt;
  
  
  Generate Fibonacci series of 50 elements
&lt;/h1&gt;

&lt;p&gt;result = fib_series(50)&lt;/p&gt;

&lt;h1&gt;
  
  
  Print the result
&lt;/h1&gt;

&lt;p&gt;print(result)&lt;br&gt;
4) a) import re&lt;/p&gt;

&lt;p&gt;def validate_email(email):&lt;br&gt;
    """&lt;br&gt;
    Validate an email address using a regular expression.&lt;/p&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Args:&lt;br&gt;
email (str): The email address to be validated.

&lt;p&gt;Returns:&lt;br&gt;
bool: True if the email address is valid, False otherwise.&lt;br&gt;
"""&lt;/p&gt;
&lt;h1&gt;
  
  
  Regular expression for email validation
&lt;/h1&gt;

&lt;p&gt;regex = r'^[\w.-]+@[a-zA-Z0-9.-]+.[a-zA-Z]{2,}$'&lt;/p&gt;
&lt;h1&gt;
  
  
  Match the email address against the regular expression
&lt;/h1&gt;

&lt;p&gt;if re.match(regex, email):&lt;br&gt;
    return True&lt;br&gt;
else:&lt;br&gt;
    return False&lt;br&gt;
&lt;/p&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h1&gt;
&lt;br&gt;
  &lt;br&gt;
  &lt;br&gt;
  Example usage:&lt;br&gt;
&lt;/h1&gt;

&lt;p&gt;email1 = "&lt;a href="mailto:example@email.com"&gt;example@email.com&lt;/a&gt;"&lt;br&gt;
email2 = "invalid_email.com"&lt;/p&gt;

&lt;p&gt;print(validate_email(email1))  # Output: True&lt;br&gt;
print(validate_email(email2))  # Output: False&lt;br&gt;
b) import re&lt;/p&gt;

&lt;p&gt;def validate_usa_mobile_number(number):&lt;br&gt;
    """&lt;br&gt;
    Validate a mobile number of the USA using a regular expression.&lt;/p&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Args:&lt;br&gt;
number (str): The mobile number to be validated.

&lt;p&gt;Returns:&lt;br&gt;
bool: True if the mobile number is valid, False otherwise.&lt;br&gt;
"""&lt;/p&gt;
&lt;h1&gt;
  
  
  Regular expression for USA mobile number validation
&lt;/h1&gt;

&lt;p&gt;regex = r'^+?1?\s*[-]?\s*(?[2-9]{1}[0-9]{2})?[-]?\s*[2-9]{1}[0-9]{2}[-]?\s*[0-9]{4}$'&lt;/p&gt;
&lt;h1&gt;
  
  
  Match the mobile number against the regular expression
&lt;/h1&gt;

&lt;p&gt;if re.match(regex, number):&lt;br&gt;
    return True&lt;br&gt;
else:&lt;br&gt;
    return False&lt;br&gt;
&lt;/p&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h1&gt;
&lt;br&gt;
  &lt;br&gt;
  &lt;br&gt;
  Example usage:&lt;br&gt;
&lt;/h1&gt;

&lt;p&gt;number1 = "+1 123-456-7890"&lt;br&gt;
number2 = "123-456-7890"&lt;br&gt;
number3 = "1234567890"&lt;br&gt;
number4 = "+1 (123) 456-7890"&lt;br&gt;
number5 = "123-456-789"  # Invalid number&lt;/p&gt;

&lt;p&gt;print(validate_usa_mobile_number(number1))  # Output: True&lt;br&gt;
print(validate_usa_mobile_number(number2))  # Output: True&lt;br&gt;
print(validate_usa_mobile_number(number3))  # Output: True&lt;br&gt;
print(validate_usa_mobile_number(number4))  # Output: True&lt;br&gt;
print(validate_usa_mobile_number(number5))  # Output: False&lt;br&gt;
c) import re&lt;/p&gt;

&lt;p&gt;def validate_usa_telephone_number(number):&lt;br&gt;
    """&lt;br&gt;
    Validate a telephone number of the USA using a regular expression.&lt;/p&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Args:&lt;br&gt;
number (str): The telephone number to be validated.

&lt;p&gt;Returns:&lt;br&gt;
bool: True if the telephone number is valid, False otherwise.&lt;br&gt;
"""&lt;/p&gt;
&lt;h1&gt;
  
  
  Regular expression for USA telephone number validation
&lt;/h1&gt;

&lt;p&gt;regex = r'^+?1?\s*[-]?\s*(?[2-9]{1}[0-9]{2})?[-]?\s*[2-9]{1}[0-9]{2}[-]?\s*[0-9]{4}$'&lt;/p&gt;
&lt;h1&gt;
  
  
  Match the telephone number against the regular expression
&lt;/h1&gt;

&lt;p&gt;if re.match(regex, number):&lt;br&gt;
    return True&lt;br&gt;
else:&lt;br&gt;
    return False&lt;br&gt;
&lt;/p&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h1&gt;
&lt;br&gt;
  &lt;br&gt;
  &lt;br&gt;
  Example usage:&lt;br&gt;
&lt;/h1&gt;

&lt;p&gt;number1 = "+1 123-456-7890"&lt;br&gt;
number2 = "123-456-7890"&lt;br&gt;
number3 = "1234567890"&lt;br&gt;
number4 = "+1 (123) 456-7890"&lt;br&gt;
number5 = "123-456-789"  # Invalid number&lt;/p&gt;

&lt;p&gt;print(validate_usa_telephone_number(number1))  # Output: True&lt;br&gt;
print(validate_usa_telephone_number(number2))  # Output: True&lt;br&gt;
print(validate_usa_telephone_number(number3))  # Output: True&lt;br&gt;
print(validate_usa_telephone_number(number4))  # Output: True&lt;br&gt;
print(validate_usa_telephone_number(number5))  # Output: False&lt;br&gt;
d) import re&lt;/p&gt;

&lt;p&gt;def validate_password(password):&lt;br&gt;
    """&lt;br&gt;
    Validate a password consisting of 16 characters with at least one upper case letter,&lt;br&gt;
    one lower case letter, one special character, and one number.&lt;/p&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Args:&lt;br&gt;
password (str): The password to be validated.

&lt;p&gt;Returns:&lt;br&gt;
bool: True if the password is valid, False otherwise.&lt;br&gt;
"""&lt;/p&gt;
&lt;h1&gt;
  
  
  Regular expression for password validation
&lt;/h1&gt;

&lt;p&gt;regex = r'^(?=.&lt;em&gt;[a-z])(?=.&lt;/em&gt;[A-Z])(?=.&lt;em&gt;\d)(?=.&lt;/em&gt;[@$!%&lt;em&gt;?&amp;amp;])[A-Za-z\d@$!%&lt;/em&gt;?&amp;amp;]{16}$'&lt;/p&gt;
&lt;h1&gt;
  
  
  Match the password against the regular expression
&lt;/h1&gt;

&lt;p&gt;if re.match(regex, password):&lt;br&gt;
    return True&lt;br&gt;
else:&lt;br&gt;
    return False&lt;br&gt;
&lt;/p&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h1&gt;
&lt;br&gt;
  &lt;br&gt;
  &lt;br&gt;
  Example usage:&lt;br&gt;
&lt;/h1&gt;

&lt;p&gt;password1 = "Password@1234"&lt;br&gt;
password2 = "Weakpassword123"&lt;br&gt;
password3 = "StrongPass!5678"&lt;/p&gt;

&lt;p&gt;print(validate_password(password1))  # Output: False&lt;br&gt;
print(validate_password(password2))  # Output: False&lt;br&gt;
print(validate_password(password3))  # Output: True&lt;/p&gt;

</description>
    </item>
    <item>
      <title>TASK 10</title>
      <dc:creator>ABUL HASAN A</dc:creator>
      <pubDate>Thu, 30 May 2024 14:29:21 +0000</pubDate>
      <link>https://dev.to/abul_4693/task-10-517i</link>
      <guid>https://dev.to/abul_4693/task-10-517i</guid>
      <description>&lt;p&gt;1) cd path/to/your/project&lt;br&gt;
pip freeze &amp;gt; requirements.txt&lt;br&gt;
Flask==2.0.1&lt;br&gt;
Jinja2==3.0.1&lt;br&gt;
MarkupSafe==2.0.1&lt;br&gt;
Werkzeug==2.0.1&lt;br&gt;
click==8.0.1&lt;br&gt;
itsdangerous==2.0.1&lt;br&gt;
pip install -r requirements.txt&lt;br&gt;
2) To install the Flask module version less than 2.0 using pip in Python, you can specify the version you want by appending it with == followed by the version number. Here's the command:&lt;br&gt;
pip install Flask&amp;lt;2.0&lt;br&gt;
This command will install the latest version of Flask that is less than 2.0. If you want to install a specific version, you can replace &amp;lt;2.0 with the desired version number, for example:&lt;br&gt;
pip install Flask==1.1.4&lt;br&gt;
This will install Flask version 1.1.4 specifically.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>task 5</title>
      <dc:creator>ABUL HASAN A</dc:creator>
      <pubDate>Thu, 30 May 2024 14:17:58 +0000</pubDate>
      <link>https://dev.to/abul_4693/task-5-42lp</link>
      <guid>https://dev.to/abul_4693/task-5-42lp</guid>
      <description>&lt;p&gt;1)&lt;br&gt;
input_string = "guvi geeks network private limited"&lt;br&gt;
vowels = "aeiou"&lt;br&gt;
vowel_counts = {vowel: 0 for vowel in vowels}&lt;br&gt;
total_vowels = 0&lt;br&gt;
for char in input_string:&lt;/p&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;char_lower = char.lower()

&lt;p&gt;if char_lower in vowels:&lt;br&gt;
    # Increment the count for this vowel&lt;br&gt;
    vowel_counts[char_lower] += 1&lt;br&gt;
    # Increment the total vowel count&lt;br&gt;
    total_vowels += 1&lt;br&gt;
&lt;/p&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h1&gt;
&lt;br&gt;
  &lt;br&gt;
  &lt;br&gt;
  Print the results&lt;br&gt;
&lt;/h1&gt;

&lt;p&gt;print("Total number of vowels:", total_vowels)&lt;br&gt;
print("Count of each individual vowel:")&lt;br&gt;
for vowel, count in vowel_counts.items():&lt;br&gt;
    print(f"{vowel.upper()}: {count}")&lt;/p&gt;

&lt;p&gt;2) # Initialize the number to start from&lt;br&gt;
current_number = 1&lt;/p&gt;

&lt;h1&gt;
  
  
  Iterate through each level of the pyramid
&lt;/h1&gt;

&lt;p&gt;for i in range(1, 21):&lt;br&gt;
    # Print numbers for the current level&lt;br&gt;
    for j in range(i):&lt;br&gt;
        if current_number &amp;gt; 20:&lt;br&gt;
            break&lt;br&gt;
        print(current_number, end=" ")&lt;br&gt;
        current_number += 1&lt;br&gt;
    # Move to the next line after each level&lt;br&gt;
    if current_number &amp;gt; 20:&lt;br&gt;
        break&lt;br&gt;
    print()&lt;br&gt;
3) def remove_vowels(input_string):&lt;br&gt;
    # Define the vowels&lt;br&gt;
    vowels = "aeiouAEIOU"&lt;/p&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# Use a list comprehension to filter out vowels from the string&lt;br&gt;
result_string = ''.join([char for char in input_string if char not in vowels])

&lt;p&gt;return result_string&lt;br&gt;
&lt;/p&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h1&gt;
&lt;br&gt;
  &lt;br&gt;
  &lt;br&gt;
  Example usage&lt;br&gt;
&lt;/h1&gt;

&lt;p&gt;input_string = "guvi geeks network private limited"&lt;br&gt;
result_string = remove_vowels(input_string)&lt;br&gt;
print("Original string:", input_string)&lt;br&gt;
print("String without vowels:", result_string)&lt;br&gt;
4) def count_unique_characters(input_string):&lt;br&gt;
    # Use a set to store unique characters&lt;br&gt;
    unique_characters = set(input_string)&lt;/p&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# Return the number of unique characters&lt;br&gt;
return len(unique_characters)&lt;br&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h1&gt;
&lt;br&gt;
  &lt;br&gt;
  &lt;br&gt;
  Example usage&lt;br&gt;
&lt;/h1&gt;

&lt;p&gt;input_string = "guvi geeks network private limited"&lt;br&gt;
unique_count = count_unique_characters(input_string)&lt;br&gt;
print("Original string:", input_string)&lt;br&gt;
print("Number of unique characters:", unique_count)&lt;br&gt;
5)def is_palindrome(input_string):&lt;br&gt;
    # Remove any non-alphanumeric characters and convert to lowercase&lt;br&gt;
    cleaned_string = ''.join(char.lower() for char in input_string if char.isalnum())&lt;/p&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# Check if the cleaned string is equal to its reverse&lt;br&gt;
return cleaned_string == cleaned_string[::-1]&lt;br&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h1&gt;
&lt;br&gt;
  &lt;br&gt;
  &lt;br&gt;
  Example usage&lt;br&gt;
&lt;/h1&gt;

&lt;p&gt;input_string = "A man, a plan, a canal, Panama"&lt;br&gt;
result = is_palindrome(input_string)&lt;br&gt;
print(f"Is the string '{input_string}' a palindrome? {result}")&lt;br&gt;
6) def longest_common_substring(str1, str2):&lt;br&gt;
    # Get the lengths of the strings&lt;br&gt;
    len1, len2 = len(str1), len(str2)&lt;/p&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# Create a 2D list to store lengths of longest common suffixes
&lt;h1&gt;
  
  
  Initialize all values to 0
&lt;/h1&gt;

&lt;p&gt;dp = [[0] * (len2 + 1) for _ in range(len1 + 1)]&lt;/p&gt;
&lt;h1&gt;
  
  
  Initialize variables to store the length of the longest common substring
&lt;/h1&gt;
&lt;h1&gt;
  
  
  and the ending index of the longest common substring in str1
&lt;/h1&gt;

&lt;p&gt;longest_length = 0&lt;br&gt;
end_index = 0&lt;/p&gt;
&lt;h1&gt;
  
  
  Build the dp array
&lt;/h1&gt;

&lt;p&gt;for i in range(1, len1 + 1):&lt;br&gt;
    for j in range(1, len2 + 1):&lt;br&gt;
        if str1[i - 1] == str2[j - 1]:&lt;br&gt;
            dp[i][j] = dp[i - 1][j - 1] + 1&lt;br&gt;
            if dp[i][j] &amp;gt; longest_length:&lt;br&gt;
                longest_length = dp[i][j]&lt;br&gt;
                end_index = i&lt;/p&gt;
&lt;h1&gt;
  
  
  Extract the longest common substring
&lt;/h1&gt;

&lt;p&gt;longest_common_substr = str1[end_index - longest_length:end_index]&lt;/p&gt;

&lt;p&gt;return longest_common_substr&lt;br&gt;
&lt;/p&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h1&gt;
&lt;br&gt;
  &lt;br&gt;
  &lt;br&gt;
  Example usage&lt;br&gt;
&lt;/h1&gt;

&lt;p&gt;str1 = "guvi geeks network"&lt;br&gt;
str2 = "geeks for geeks network"&lt;br&gt;
result = longest_common_substring(str1, str2)&lt;br&gt;
print("Longest common substring:", result)&lt;br&gt;
7) def most_frequent_character(input_string):&lt;br&gt;
    # Create a dictionary to store the frequency of each character&lt;br&gt;
    frequency_dict = {}&lt;/p&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# Iterate through each character in the string&lt;br&gt;
for char in input_string:&lt;br&gt;
    if char in frequency_dict:&lt;br&gt;
        frequency_dict[char] += 1&lt;br&gt;
    else:&lt;br&gt;
        frequency_dict[char] = 1
&lt;h1&gt;
  
  
  Find the character with the maximum frequency
&lt;/h1&gt;

&lt;p&gt;most_frequent_char = max(frequency_dict, key=frequency_dict.get)&lt;/p&gt;

&lt;p&gt;return most_frequent_char&lt;br&gt;
&lt;/p&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h1&gt;
&lt;br&gt;
  &lt;br&gt;
  &lt;br&gt;
  Example usage&lt;br&gt;
&lt;/h1&gt;

&lt;p&gt;input_string = "guvi geeks network private limited"&lt;br&gt;
result = most_frequent_character(input_string)&lt;br&gt;
print("Most frequent character:", result)&lt;br&gt;
8)def are_anagrams(str1, str2):&lt;br&gt;
    # Remove any non-alphanumeric characters and convert to lowercase&lt;br&gt;
    cleaned_str1 = ''.join(char.lower() for char in str1 if char.isalnum())&lt;br&gt;
    cleaned_str2 = ''.join(char.lower() for char in str2 if char.isalnum())&lt;/p&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# Sort the cleaned strings and compare&lt;br&gt;
return sorted(cleaned_str1) == sorted(cleaned_str2)&lt;br&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h1&gt;
&lt;br&gt;
  &lt;br&gt;
  &lt;br&gt;
  Example usage&lt;br&gt;
&lt;/h1&gt;

&lt;p&gt;str1 = "Listen"&lt;br&gt;
str2 = "Silent"&lt;br&gt;
result = are_anagrams(str1, str2)&lt;br&gt;
print(f"Are the strings '{str1}' and '{str2}' anagrams? {result}")&lt;br&gt;
9)def count_words(input_string):&lt;br&gt;
    # Split the string into words based on whitespace&lt;br&gt;
    words = input_string.split()&lt;/p&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# Return the number of words&lt;br&gt;
return len(words)&lt;br&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h1&gt;
&lt;br&gt;
  &lt;br&gt;
  &lt;br&gt;
  Example usage&lt;br&gt;
&lt;/h1&gt;

&lt;p&gt;input_string = "guvi geeks network private limited"&lt;br&gt;
word_count = count_words(input_string)&lt;br&gt;
print(f"Number of words in the string: {word_count}")&lt;/p&gt;

</description>
    </item>
    <item>
      <title>task 23</title>
      <dc:creator>ABUL HASAN A</dc:creator>
      <pubDate>Sun, 03 Dec 2023 08:17:10 +0000</pubDate>
      <link>https://dev.to/abul_4693/task-23-4k0a</link>
      <guid>https://dev.to/abul_4693/task-23-4k0a</guid>
      <description>&lt;p&gt;from selenium import webdriver&lt;br&gt;
from selenium.webdriver.common.by import By&lt;br&gt;
from selenium.webdriver.common.action_chains import ActionChains&lt;br&gt;
import time&lt;/p&gt;

&lt;h1&gt;
  
  
  Set up the webdriver (make sure to provide the path to your webdriver executable)
&lt;/h1&gt;

&lt;p&gt;driver_path = '/path/to/chromedriver'&lt;br&gt;
driver = webdriver.Chrome(executable_path=driver_path)&lt;/p&gt;

&lt;h1&gt;
  
  
  Open the URL
&lt;/h1&gt;

&lt;p&gt;url = '&lt;a href="https://jqueryui.com/droppable/"&gt;https://jqueryui.com/droppable/&lt;/a&gt;'&lt;br&gt;
driver.get(url)&lt;br&gt;
time.sleep(2)  # Wait for the page to load&lt;/p&gt;

&lt;h1&gt;
  
  
  Switch to the iframe containing the draggable elements
&lt;/h1&gt;

&lt;p&gt;driver.switch_to.frame(driver.find_element(By.CLASS_NAME, 'demo-frame'))&lt;/p&gt;

&lt;h1&gt;
  
  
  Find the draggable element (White Box)
&lt;/h1&gt;

&lt;p&gt;draggable_element = driver.find_element(By.ID, 'draggable')&lt;/p&gt;

&lt;h1&gt;
  
  
  Find the droppable element (Yellow Rectangular Box)
&lt;/h1&gt;

&lt;p&gt;droppable_element = driver.find_element(By.ID, 'droppable')&lt;/p&gt;

&lt;h1&gt;
  
  
  Use Action Chains to perform the Drag and Drop operation
&lt;/h1&gt;

&lt;p&gt;actions = ActionChains(driver)&lt;br&gt;
actions.drag_and_drop(draggable_element, droppable_element).perform()&lt;/p&gt;

&lt;h1&gt;
  
  
  Switch back to the default content
&lt;/h1&gt;

&lt;p&gt;driver.switch_to.default_content()&lt;/p&gt;

&lt;h1&gt;
  
  
  Wait for a moment to see the result
&lt;/h1&gt;

&lt;p&gt;time.sleep(2)&lt;/p&gt;

&lt;h1&gt;
  
  
  Close the browser
&lt;/h1&gt;

&lt;p&gt;driver.quit()&lt;/p&gt;

</description>
    </item>
  </channel>
</rss>
