Luna  Hermann

Luna Hermann


Getting Started with Web Accessibility With Ashlee Boyer

Accessibility is a big topic that can seem hard to get into because there is so much to learn! Being far from an accessibility expert myself, but doing my best to learn more about it, I interviewed Ashlee Boyer to talk about what accessibility is, why it matters, and how we can get started with it without feeling overwhelmed.

🔗 Links
✅ Follow Ashlee on Twitter:
✅ The a11y Project:
✅ Tatiana Mack’s article on prefers-reduced-motion:
✅ WAI-ARIA authoring practices:
Spoon theory -

⌚ Timestamps

  • 00:00 - Introduction
  • 01:10 - Introduction to Ashlee
  • 03:52 - What does “improve accessibility” mean?
  • 05:32 - The four categories of disabilities
  • 07:18 - Visual disabilities
  • 09:14 - The importance of semantic HTML
  • 10:49 - Auditory disabilities
  • 13:35 - Motor disabilities
  • 16:08 - Cognitive disabilities
  • 20:37 - ARIA roles
  • 24:17 - You don’t have to learn it all at once
  • 28:30 - Dark mode


Come hang out with other dev’s in my Discord Community

Keep up to date with everything I’m up to

Come hang out with me live every Monday on Twitch!

Help support my channel
👹‍🎓 Get a course:
👕 Buy a shirt:
💖 Support me on Patreon:

My editor: VS Code -

I’m on some other places on the internet too!

If you’d like a behind the scenes and previews of what’s coming up on my YouTube channel, make sure to follow me on Instagram and Twitter.


And whatever you do, don’t forget to keep on making your corner of the internet just a little bit more awesome!

#developer #web-development

What is GEEK

Buddha Community

Getting Started with Web Accessibility With Ashlee Boyer
Shubham Ankit

Shubham Ankit


How to Automate Excel with Python | Python Excel Tutorial (OpenPyXL)

How to Automate Excel with Python

In this article, We will show how we can use python to automate Excel . A useful Python library is Openpyxl which we will learn to do Excel Automation


Openpyxl is a Python library that is used to read from an Excel file or write to an Excel file. Data scientists use Openpyxl for data analysis, data copying, data mining, drawing charts, styling sheets, adding formulas, and more.

Workbook: A spreadsheet is represented as a workbook in openpyxl. A workbook consists of one or more sheets.

Sheet: A sheet is a single page composed of cells for organizing data.

Cell: The intersection of a row and a column is called a cell. Usually represented by A1, B5, etc.

Row: A row is a horizontal line represented by a number (1,2, etc.).

Column: A column is a vertical line represented by a capital letter (A, B, etc.).

Openpyxl can be installed using the pip command and it is recommended to install it in a virtual environment.

pip install openpyxl


We start by creating a new spreadsheet, which is called a workbook in Openpyxl. We import the workbook module from Openpyxl and use the function Workbook() which creates a new workbook.

from openpyxl
import Workbook
#creates a new workbook
wb = Workbook()
#Gets the first active worksheet
ws =
#creating new worksheets by using the create_sheet method

ws1 = wb.create_sheet("sheet1", 0) #inserts at first position
ws2 = wb.create_sheet("sheet2") #inserts at last position
ws3 = wb.create_sheet("sheet3", -1) #inserts at penultimate position

#Renaming the sheet
ws.title = "Example"

#save the workbook = "example.xlsx")


We load the file using the function load_Workbook() which takes the filename as an argument. The file must be saved in the same working directory.

#loading a workbook
wb = openpyxl.load_workbook("example.xlsx")




#getting sheet names
result = ['sheet1', 'Sheet', 'sheet3', 'sheet2']

#getting a particular sheet
sheet1 = wb["sheet2"]

#getting sheet title
result = 'sheet2'

#Getting the active sheet
sheetactive =
result = 'sheet1'




#get a cell from the sheet
sheet1["A1"] <
  Cell 'Sheet1'.A1 >

  #get the cell value
ws["A1"].value 'Segment'

#accessing cell using row and column and assigning a value
d = ws.cell(row = 4, column = 2, value = 10)




#looping through each row and column
for x in range(1, 5):
  for y in range(1, 5):
  print(x, y, ws.cell(row = x, column = y)

#getting the highest row number

#getting the highest column number

There are two functions for iterating through rows and columns.

Iter_rows() => returns the rows
Iter_cols() => returns the columns {
  min_row = 4, max_row = 5, min_col = 2, max_col = 5
} => This can be used to set the boundaries
for any iteration.


#iterating rows
for row in ws.iter_rows(min_row = 2, max_col = 3, max_row = 3):
  for cell in row:
  print(cell) <
  Cell 'Sheet1'.A2 >
  Cell 'Sheet1'.B2 >
  Cell 'Sheet1'.C2 >
  Cell 'Sheet1'.A3 >
  Cell 'Sheet1'.B3 >
  Cell 'Sheet1'.C3 >

  #iterating columns
for col in ws.iter_cols(min_row = 2, max_col = 3, max_row = 3):
  for cell in col:
  print(cell) <
  Cell 'Sheet1'.A2 >
  Cell 'Sheet1'.A3 >
  Cell 'Sheet1'.B2 >
  Cell 'Sheet1'.B3 >
  Cell 'Sheet1'.C2 >
  Cell 'Sheet1'.C3 >

To get all the rows of the worksheet we use the method worksheet.rows and to get all the columns of the worksheet we use the method worksheet.columns. Similarly, to iterate only through the values we use the method worksheet.values.


for row in ws.values:
  for value in row:



Writing to a workbook can be done in many ways such as adding a formula, adding charts, images, updating cell values, inserting rows and columns, etc
 We will discuss each of these with an example.




#creates a new workbook
wb = openpyxl.Workbook()

#saving the workbook"new.xlsx")




#creating a new sheet
ws1 = wb.create_sheet(title = "sheet 2")

#creating a new sheet at index 0
ws2 = wb.create_sheet(index = 0, title = "sheet 0")

#checking the sheet names
wb.sheetnames['sheet 0', 'Sheet', 'sheet 2']

#deleting a sheet
del wb['sheet 0']

#checking sheetnames
wb.sheetnames['Sheet', 'sheet 2']




#checking the sheet value

#adding value to cell
ws['B2'] = 367

#checking value




We often require formulas to be included in our Excel datasheet. We can easily add formulas using the Openpyxl module just like you add values to a cell.

For example:

import openpyxl
from openpyxl
import Workbook

wb = openpyxl.load_workbook("new1.xlsx")
ws = wb['Sheet']

ws['A9'] = '=SUM(A2:A8)'"new2.xlsx")

The above program will add the formula (=SUM(A2:A8)) in cell A9. The result will be as below.




Two or more cells can be merged to a rectangular area using the method merge_cells(), and similarly, they can be unmerged using the method unmerge_cells().

For example:
Merge cells

#merge cells B2 to C9
ws['B2'] = "Merged cells"

Adding the above code to the previous example will merge cells as below.




#unmerge cells B2 to C9

The above code will unmerge cells from B2 to C9.


To insert an image we import the image function from the module openpyxl.drawing.image. We then load our image and add it to the cell as shown in the below example.


import openpyxl
from openpyxl
import Workbook
from openpyxl.drawing.image
import Image

wb = openpyxl.load_workbook("new1.xlsx")
ws = wb['Sheet']
#loading the image(should be in same folder)
img = Image('logo.png')
ws['A1'] = "Adding image"
#adjusting size
img.height = 130
img.width = 200
#adding img to cell A3

ws.add_image(img, 'A3')"new2.xlsx")




Charts are essential to show a visualization of data. We can create charts from Excel data using the Openpyxl module chart. Different forms of charts such as line charts, bar charts, 3D line charts, etc., can be created. We need to create a reference that contains the data to be used for the chart, which is nothing but a selection of cells (rows and columns). I am using sample data to create a 3D bar chart in the below example:


import openpyxl
from openpyxl
import Workbook
from openpyxl.chart
import BarChart3D, Reference, series

wb = openpyxl.load_workbook("example.xlsx")
ws =

values = Reference(ws, min_col = 3, min_row = 2, max_col = 3, max_row = 40)
chart = BarChart3D()
ws.add_chart(chart, "E3")"MyChart.xlsx")


How to Automate Excel with Python with Video Tutorial

Welcome to another video! In this video, We will cover how we can use python to automate Excel. I'll be going over everything from creating workbooks to accessing individual cells and stylizing cells. There is a ton of things that you can do with Excel but I'll just be covering the core/base things in OpenPyXl.

⭐ Timestamps ⭐
00:00 | Introduction
02:14 | Installing openpyxl
03:19 | Testing Installation
04:25 | Loading an Existing Workbook
06:46 | Accessing Worksheets
07:37 | Accessing Cell Values
08:58 | Saving Workbooks
09:52 | Creating, Listing and Changing Sheets
11:50 | Creating a New Workbook
12:39 | Adding/Appending Rows
14:26 | Accessing Multiple Cells
20:46 | Merging Cells
22:27 | Inserting and Deleting Rows
23:35 | Inserting and Deleting Columns
24:48 | Copying and Moving Cells
26:06 | Practical Example, Formulas & Cell Styling

📄 Resources 📄
OpenPyXL Docs: 
Code Written in This Tutorial: 


Monty  Boehm

Monty Boehm


Twitter.jl: Julia Package to Access Twitter API


A Julia package for interacting with the Twitter API.

Twitter.jl is a Julia package to work with the Twitter API v1.1. Currently, only the REST API methods are supported; streaming API endpoints aren't implemented at this time.

All functions have required arguments for those parameters required by Twitter and an options keyword argument to provide a Dict{String, String} of optional parameters Twitter API documentation. Most function calls will return either a Dict or an Array <: TwitterType. Bad requests will return the response code from the API (403, 404, etc).

DataFrame methods are defined for functions returning composite types: Tweets, Places, Lists, and Users.


Before one can make use of this package, you must create an application on the Twitter's Developer Platform.

Once your application is approved, you can access your dashboard/portal to grab your authentication credentials from the "Details" tab of the application.

Note that you will also want to ensure that your App has Read / Write OAuth access in order to post tweets. You can find out more about this on Stack Overflow.


To install this package, enter ] on the REPL to bring up Julia's package manager. Then add the package:

julia> ]
(v1.7) pkg> add Twitter

Tip: Press Ctrl+C to return to the julia> prompt.


To run Twitter.jl, enter the following command in your Julia REPL

julia> using Twitter

Then the a global variable has to be declared with the twitterauth function. This function holds the consumer_key(API Key), consumer_secret(API Key Secret), oauth_token(Access Token), and oauth_secret(Access Token Secret) respectively.

twitterauth("6nOtpXmf...", # API Key
            "sES5Zlj096S...", # API Key Secret
            "98689850-Hj...", # Access Token
            "UroqCVpWKIt...") # Access Token Secret
  • Ensure you put your credentials in an env file to avoid pushing your secrets to the public 🙀.

Note: This package does not currently support OAuth authentication.

Code examples

See runtests.jl for example function calls.

using Twitter, Test
using JSON, OAuth

# set debugging


mentions_timeline_default = get_mentions_timeline()
tw = mentions_timeline_default[1]
tw_df = DataFrame(mentions_timeline_default)
@test 0 <= length(mentions_timeline_default) <= 20
@test typeof(mentions_timeline_default) == Vector{Tweets}
@test typeof(tw) == Tweets
@test size(tw_df)[2] == 30

user_timeline_default = get_user_timeline(screen_name = "randyzwitch")
@test typeof(user_timeline_default) == Vector{Tweets}

home_timeline_default = get_home_timeline()
@test typeof(home_timeline_default) == Vector{Tweets}

get_tweet_by_id = get_single_tweet_id(id = "434685122671939584")
@test typeof(get_tweet_by_id) == Tweets

duke_tweets = get_search_tweets(q = "#Duke", count = 200)
@test typeof(duke_tweets) <: Dict

#test sending/deleting direct messages
#commenting out because Twitter API changed. Come back to fix
# send_dm = post_direct_messages_send(text = "Testing from Julia, this might disappear later $(time())", screen_name = "randyzwitch")
# get_single_dm = get_direct_messages_show(id =
# destroy = post_direct_messages_destroy(id =
# @test typeof(send_dm) == Tweets
# @test typeof(get_single_dm) == Tweets
# @test typeof(destroy) == Tweets

#creating/destroying friendships
add_friend = post_friendships_create(screen_name = "kyrieirving")

unfollow = post_friendships_destroy(screen_name = "kyrieirving")
unfollow_df = DataFrame(unfollow)
@test typeof(add_friend) == Users
@test typeof(unfollow) == Users
@test size(unfollow_df)[2] == 40

# create a cursor for follower ids
follow_cursor_test = get_followers_ids(screen_name = "twitter", count = 10_000)
@test length(follow_cursor_test["ids"]) == 10_000

# create a cursor for friend ids - use barackobama because he follows a lot of accounts!
friend_cursor_test = get_friends_ids(screen_name = "BarackObama", count = 10_000)
@test length(friend_cursor_test["ids"]) == 10_000

# create a test for home timelines
home_t = get_home_timeline(count = 2)
@test length(home_t) > 1

# TEST of cursoring functionality on user timelines
user_t = get_user_timeline(screen_name = "stefanjwojcik", count = 400)
@test length(user_t) == 400
# get the minimum ID of the tweets returned (the earliest)
minid = minimum( for x in user_t);

# now iterate until you hit that tweet: should return 399
# WARNING: current versions of julia cannot use keywords in macros? read here:
# eventually replace since_id = minid
tweets_since = get_user_timeline(screen_name = "stefanjwojcik", count = 400, since_id = 1001808621053898752, include_rts=1)

@test length(tweets_since)>=399

# testing get_mentions_timeline
mentions = get_mentions_timeline(screen_name = "stefanjwojcik", count = 300) 
@test length(mentions) >= 50 #sometimes API doesn't return number requested (twitter API specifies count is the max returned, may be much lower)
@test Tweets<:typeof(mentions[1])

# testing retweets_of_me
my_rts = get_retweets_of_me(count = 300)
@test Tweets<:typeof(my_rts[1])

Want to contribute?

Contributions are welcome! Kindly refer to the contribution guidelines.

Linux: Build Status 

CodeCov: codecov

Author: Randyzwitch
Source Code: 
License: View license

#julia #api #twitter 

Lia  Haley

Lia Haley


The World Needs Web Accessibility Now More Than Ever

A background with a top view of a laptop keyboard and text that reads, the web has become less accessible.

I attended a talk last year by Mike Gifford where he said, “the web has actually become LESS accessible since 2011.”

It’s cheap and easy for anyone to create a website these days, and hardly anyone considers accessibility. And why would you? If it’s not in your daily purview, it’s not going into your list of website requirements. Heck, most people don’t even think of the end user, Disabled or not, when creating a website. Especially not when they use a “drag and drop” style website creation platform. Nothing against those, just that those platforms often don’t have accessibility built in, and it’s very difficult to make them so, even if you had the desire.

The other aspect working against website accessibility is when you say the word, ‘accessibility’ not every even has a concept of what that means. I asked a website designer recently if he makes accessible websites, and he said, “yes
we add alt-tags to all our images.” Ummmm, OK. Great. But can a screen reader read your website?

So let’s dispel some myths and dive a bit into the world of what it means to implement web accessibility.

First off, it’s important to note that the USA actually has very clear legislation regarding accessibility. It’s called the Americans With Disabilities Act, and it includes websites. US-based companies should be aware that not having a minimally accessible business website can leave you open to a law suit and fines. I’m Canadian with a Canadian registered company, so I do not actually have to worry about getting sued for not having an accessible website, but bonus, I have one anyway! I’ll explain why it’s beneficial to have an accessible website even if you are not a US-based company.

#accessibility #web-accessibility #accessibility-design #accessibility-testing #amazon web services

Evolution in Web Design: A Case Study of 25 Years - Prismetric

The term web design simply encompasses a design process related to the front-end design of website that includes writing mark-up. Creative web design has a considerable impact on your perceived business credibility and quality. It taps onto the broader scopes of web development services.

Web designing is identified as a critical factor for the success of websites and eCommerce. The internet has completely changed the way businesses and brands operate. Web design and web development go hand-in-hand and the need for a professional web design and development company, offering a blend of creative designs and user-centric elements at an affordable rate, is growing at a significant rate.

In this blog, we have focused on the different areas of designing a website that covers all the trends, tools, and techniques coming up with time.

Web design
In 2020 itself, the number of smartphone users across the globe stands at 6.95 billion, with experts suggesting a high rise of 17.75 billion by 2024. On the other hand, the percentage of Gen Z web and internet users worldwide is up to 98%. This is not just a huge market but a ginormous one to boost your business and grow your presence online.

Web Design History
At a huge particle physics laboratory, CERN in Switzerland, the son of computer scientist Barner Lee published the first-ever website on August 6, 1991. He is not only the first web designer but also the creator of HTML (HyperText Markup Language). The worldwide web persisted and after two years, the world’s first search engine was born. This was just the beginning.

Evolution of Web Design over the years
With the release of the Internet web browser and Windows 95 in 1995, most trading companies at that time saw innumerable possibilities of instant worldwide information and public sharing of websites to increase their sales. This led to the prospect of eCommerce and worldwide group communications.

The next few years saw a soaring launch of the now-so-famous websites such as Yahoo, Amazon, eBay, Google, and substantially more. In 2004, by the time Facebook was launched, there were more than 50 million websites online.

Then came the era of Google, the ruler of all search engines introducing us to search engine optimization (SEO) and businesses sought their ways to improve their ranks. The world turned more towards mobile web experiences and responsive mobile-friendly web designs became requisite.

Let’s take a deep look at the evolution of illustrious brands to have a profound understanding of web design.

Here is a retrospection of a few widely acclaimed brands over the years.

From a simple idea of renting DVDs online to a multi-billion-dollar business, saying that Netflix has come a long way is an understatement. A company that has sent shockwaves across Hollywood in the form of content delivery. Abundantly, Netflix (NFLX) is responsible for the rise in streaming services across 190 countries and meaningful changes in the entertainment industry.


The idea of Netflix was born when Reed Hastings and Marc Randolph decided to rent DVDs by mail. With 925 titles and a pay-per-rental model, debuts the first DVD rental and sales site with all novel features. It offered unlimited rentals without due dates or monthly rental limitations with a personalized movie recommendation system.

Netflix 1997-2000


Announcing its initial public offering (IPO) under the NASDAQ ticker NFLX, Netflix reached over 1 million subscribers in the United States by introducing a profile feature in their influential website design along with a free trial allowing members to create lists and rate their favorite movies. The user experience was quite engaging with the categorization of content, recommendations based on history, search engine, and a queue of movies to watch.

Netflix 2001-2005 -2003


They then unleashed streaming and partnering with electronic brands such as blu-ray, Xbox, and set-top boxes so that users can watch series and films straight away. Later in 2010, they also launched their sophisticated website on mobile devices with its iconic red and black themed background.

Netflix 2006-2010 -2007


In 2013, an eye-tracking test revealed that the users didn’t focus on the details of the movie or show in the existing interface and were perplexed with the flow of information. Hence, the professional web designers simply shifted the text from the right side to the top of the screen. With Daredevil, an audio description feature was also launched for the visually impaired ones.

Netflix 2011-2015


These years, Netflix came with a plethora of new features for their modern website design such as AutoPay, snippets of trailers, recommendations categorized by genre, percentage based on user experience, upcoming shows, top 10 lists, etc. These web application features yielded better results in visual hierarchy and flow of information across the website.

Netflix 2016-2020


With a sleek logo in their iconic red N, timeless black background with a ‘Watch anywhere, Cancel anytime’ the color, the combination, the statement, and the leading ott platform for top video streaming service Netflix has overgrown into a revolutionary lifestyle of Netflix and Chill.

Netflix 2021

Contunue to read: Evolution in Web Design: A Case Study of 25 Years

#web #web-design #web-design-development #web-design-case-study #web-design-history #web-development

Thierry  Perret

Thierry Perret


Les Structures De Données Les Plus Couramment Utilisées En Python

Dans tout langage de programmation, nous devons traiter des donnĂ©es. Maintenant, l'une des choses les plus fondamentales dont nous avons besoin pour travailler avec les donnĂ©es est de les stocker, de les gĂ©rer et d'y accĂ©der efficacement de maniĂšre organisĂ©e afin qu'elles puissent ĂȘtre utilisĂ©es chaque fois que cela est nĂ©cessaire pour nos besoins. Les structures de donnĂ©es sont utilisĂ©es pour rĂ©pondre Ă  tous nos besoins.

Que sont les Structures de Données ?

Les structures de données sont les blocs de construction fondamentaux d'un langage de programmation. Il vise à fournir une approche systématique pour répondre à toutes les exigences mentionnées précédemment dans l'article. Les structures de données en Python sont List, Tuple, Dictionary et Set . Ils sont considérés comme des structures de données implicites ou intégrées dans Python . Nous pouvons utiliser ces structures de données et leur appliquer de nombreuses méthodes pour gérer, relier, manipuler et utiliser nos données.

Nous avons également des structures de données personnalisées définies par l'utilisateur, à savoir Stack , Queue , Tree , Linked List et Graph . Ils permettent aux utilisateurs d'avoir un contrÎle total sur leurs fonctionnalités et de les utiliser à des fins de programmation avancées. Cependant, nous nous concentrerons sur les structures de données intégrées pour cet article.

Structures de données implicites Python

Structures de données implicites Python


Les listes nous aident Ă  stocker nos donnĂ©es de maniĂšre sĂ©quentielle avec plusieurs types de donnĂ©es. Ils sont comparables aux tableaux Ă  l'exception qu'ils peuvent stocker diffĂ©rents types de donnĂ©es comme des chaĂźnes et des nombres en mĂȘme temps. Chaque Ă©lĂ©ment ou Ă©lĂ©ment d'une liste a un index attribuĂ©. Étant donnĂ© que Python utilise l' indexation basĂ©e sur 0 , le premier Ă©lĂ©ment a un index de 0 et le comptage continue. Le dernier Ă©lĂ©ment d'une liste commence par -1 qui peut ĂȘtre utilisĂ© pour accĂ©der aux Ă©lĂ©ments du dernier au premier. Pour crĂ©er une liste, nous devons Ă©crire les Ă©lĂ©ments Ă  l'intĂ©rieur des crochets .

L'une des choses les plus importantes à retenir à propos des listes est qu'elles sont Mutable . Cela signifie simplement que nous pouvons modifier un élément dans une liste en y accédant directement dans le cadre de l'instruction d'affectation à l'aide de l'opérateur d'indexation. Nous pouvons également effectuer des opérations sur notre liste pour obtenir la sortie souhaitée. Passons en revue le code pour mieux comprendre les opérations de liste et de liste.

1. Créer une liste

#creating the list
my_list = ['p', 'r', 'o', 'b', 'e']


['p', 'r', 'o', 'b', 'e']

2. Accéder aux éléments de la liste

#accessing the list 
#accessing the first item of the list


#accessing the third item of the list

3. Ajouter de nouveaux éléments à la liste

#adding item to the list
my_list + ['k']


['p', 'r', 'o', 'b', 'e', 'k']

4. Suppression d'éléments

#removing item from the list
#Method 1:
#Deleting list items
my_list = ['p', 'r', 'o', 'b', 'l', 'e', 'm']
# delete one item
del my_list[2]
# delete multiple items
del my_list[1:5]


['p', 'r', 'b', 'l', 'e', 'm']
['p', 'm']
#Method 2:
#with remove fucntion
my_list = ['p','r','o','k','l','y','m']
#Method 3:
#with pop function
# Output: ['r', 'k', 'l', 'y', 'm']


['r', 'o', 'k', 'l', 'y', 'm']
['r', 'k', 'l', 'y', 'm']

5. Liste de tri

#sorting of list in ascending order


['k', 'l', 'm', 'r', 'y']
#sorting of list in descending order


['y', 'r', 'm', 'l', 'k']

6. Trouver la longueur d'une liste

#finding the length of list




Les tuples sont trĂšs similaires aux listes avec une diffĂ©rence clĂ© qu'un tuple est IMMUTABLE , contrairement Ă  une liste. Une fois que nous avons crĂ©Ă© un tuple ou que nous avons un tuple, nous ne sommes pas autorisĂ©s Ă  modifier les Ă©lĂ©ments qu'il contient. Cependant, si nous avons un Ă©lĂ©ment Ă  l'intĂ©rieur d'un tuple, qui est une liste elle-mĂȘme, alors seulement nous pouvons accĂ©der ou changer dans cette liste. Pour crĂ©er un tuple, nous devons Ă©crire les Ă©lĂ©ments entre parenthĂšses . Comme les listes, nous avons des mĂ©thodes similaires qui peuvent ĂȘtre utilisĂ©es avec des tuples. Passons en revue quelques extraits de code pour comprendre l'utilisation des tuples.

1. Créer un tuple

#creating of tuple
my_tuple = ("apple", "banana", "guava")


('apple', 'banana', 'guava')

2. Accéder aux éléments d'un Tuple

#accessing first element in tuple



3. Longueur d'un tuple

#for finding the lenght of tuple



4. Conversion d'un tuple en liste

#converting tuple into a list
my_tuple_list = list(my_tuple)



5. Inverser un tuple

#Reversing a tuple
tuple(sorted(my_tuple, reverse=True)) 


('guava', 'banana', 'apple')

6. Trier un tuple

#sorting tuple in ascending order


('apple', 'banana', 'guava')

7. Supprimer des éléments de Tuple

Pour supprimer des Ă©lĂ©ments du tuple, nous avons d'abord converti le tuple en une liste comme nous l'avons fait dans l'une de nos mĂ©thodes ci-dessus (point n ° 4), puis avons suivi le mĂȘme processus de la liste et avons explicitement supprimĂ© un tuple entier, juste en utilisant le del dĂ©claration .


Dictionary est une collection, ce qui signifie simplement qu'il est utilisĂ© pour stocker une valeur avec une clĂ© et extraire la valeur donnĂ©e Ă  la clĂ©. Nous pouvons le considĂ©rer comme un ensemble de clĂ©s : des paires de valeurs et chaque clĂ© d'un dictionnaire est supposĂ©e ĂȘtre unique afin que nous puissions accĂ©der aux valeurs correspondantes en consĂ©quence.

Un dictionnaire est indiqué par l'utilisation d' accolades { } contenant les paires clé : valeur. Chacune des paires d'un dictionnaire est séparée par des virgules. Les éléments d'un dictionnaire ne sont pas ordonnés , la séquence n'a pas d'importance pendant que nous y accédons ou que nous les stockons.

Ils sont MUTABLES ce qui signifie que nous pouvons ajouter, supprimer ou mettre à jour des éléments dans un dictionnaire. Voici quelques exemples de code pour mieux comprendre un dictionnaire en python.

Un point important à noter est que nous ne pouvons pas utiliser un objet mutable comme clé dans le dictionnaire. Ainsi, une liste n'est pas autorisée comme clé dans le dictionnaire.

1. Création d'un dictionnaire

#creating a dictionary
my_dict = {


{1: 'Delhi', 2: 'Patna', 3: 'Bangalore'}

Ici, les entiers sont les clés du dictionnaire et le nom de ville associé aux entiers sont les valeurs du dictionnaire.

2. Accéder aux éléments d'un dictionnaire

#access an item



3. Longueur d'un dictionnaire

#length of the dictionary



4. Trier un dictionnaire

#sorting based on the key 
#sorting based on the values of dictionary


[(1, 'Delhi'), (2, 'Bangalore'), (3, 'Patna')]
['Bangalore', 'Delhi', 'Patna']

5. Ajout d'éléments dans le dictionnaire

#adding a new item in dictionary 
my_dict[4] = 'Lucknow'


{1: 'Delhi', 2: 'Patna', 3: 'Bangalore', 4: 'Lucknow'}

6. Suppression d'éléments du dictionnaire

#for deleting an item from dict using the specific key
#for deleting last item from the list
#for clearing the dictionary


{1: 'Delhi', 2: 'Patna', 3: 'Bangalore'}
(3, 'Bangalore')


Set est un autre type de donnĂ©es en python qui est une collection non ordonnĂ©e sans Ă©lĂ©ments en double. Les cas d'utilisation courants d'un ensemble consistent Ă  supprimer les valeurs en double et Ă  effectuer des tests d'appartenance. Les accolades ou la set()fonction peuvent ĂȘtre utilisĂ©es pour crĂ©er des ensembles. Une chose Ă  garder Ă  l'esprit est que lors de la crĂ©ation d'un ensemble vide, nous devons utiliser set(), et . Ce dernier crĂ©e un dictionnaire vide. not { }

Voici quelques exemples de code pour mieux comprendre les ensembles en python.

1. Créer un ensemble

#creating set
my_set = {"apple", "mango", "strawberry", "apple"}


{'apple', 'strawberry', 'mango'}

2. Accéder aux éléments d'un ensemble

#to test for an element inside the set
"apple" in my_set



3. Longueur d'un ensemble




4. Trier un ensemble



['apple', 'mango', 'strawberry']

5. Ajout d'éléments dans Set



{'apple', 'guava', 'mango', 'strawberry'}

6. Suppression d'éléments de Set



{'apple', 'guava', 'strawberry'}


Dans cet article, nous avons passé en revue les structures de données les plus couramment utilisées en python et avons également vu diverses méthodes qui leur sont associées.

Lien :

#python #datastructures