Python Learning
5.93K subscribers
426 photos
1 video
59 files
106 links
Python Coding resources, Cheat Sheets & Quizzes! šŸ§‘ā€šŸ’»

Free courses: @bigdataspecialist

@datascience_bds
@github_repositories_bds
@coding_interview_preparation
@tech_news_bds

DMCA: @disclosure_bds

Contact: @mldatascientist
Download Telegram
What will be the output of the following Python code?
Anonymous Quiz
25%
a b c d
35%
0 1 2 3
30%
error
10%
1 2 3 4
ā¤2
Using tuples as keys in dictionaries
Since tuples are hashable, and list is not, we must use tuple as the key if we need to create a composite key to use in a dictionary.

Example: We would come across a composite key if we need to create a telephone directory that maps, first-name, last-name, pairs of telephone numbers, etc. Assuming that we have declared the variables as last and first number, we could write a dictionary assignment statement as shown below:

directory[last,first] = number

Inside the brackets, the expression is a tuple. We could use tuple assignment in a for loop to navigate this dictionary.

for last, first in directory:
print first, last, directory[last, first]

This loop navigates the keys in the directory, which are tuples. It assigns the elements of each tuple to last and first and then prints the name and corresponding telephone number.

Tuples and dictionary

Dictionary can return the list of tuples by calling items, where each tuple is a key value pair.

a = {'x':100, 'y':200}
b = list(a.items())
print(b)


šŸ”— Read Online

#Python #python_3
āž–āž–āž–āž–āž–āž–āž–āž–āž–āž–āž–āž–āž–
Join @python_bds for more cool data science materials.
*This channel belongs to @bigdataspecialist group
šŸ‘4ā¤2
What will be the output of the following Python code?
Anonymous Quiz
11%
a b c d
25%
0 1 2 3
57%
error
8%
1 2 3 4
ā¤2
Python Libraries every Data Scientist should know
ā¤2šŸ‘2
What will be the output of the following Python code snippet?
Anonymous Quiz
29%
a b c d
19%
0 1 2 3
44%
error
7%
none
ā¤2
Learn R and Python Programming for Data Visualization

From Raw Data to Insightful Narratives: Creating Visual Charts

ā° Free Online Course
šŸŽ¬ video lessons
Rating ā­ļø: 4.6 out 5
Students šŸ‘Øā€šŸŽ“ : 2,300
Duration ā° : 1hr 56min of on-demand video
Created by šŸ‘Øā€šŸ«: Pranjal Srivastava, Harshit Srivastava

šŸ”— COURSE LINK


#python #programming #R
āž–āž–āž–āž–āž–āž–āž–āž–āž–āž–āž–āž–āž–āž–
šŸ‘‰Join @python_bds for morešŸ‘ˆ
ā¤3šŸ‘2
ā¤4
What will be the output of the following Python code snippet?
Anonymous Quiz
19%
abcd
49%
ABCD
31%
error
1%
none
ā¤5šŸ‘4
Deleting Tuples

Tuples are immutable and cannot be deleted. You cannot delete or remove items from a tuple. But deleting tuple entirely is possible by using the keyword

del

Slicing of Tuple

To fetch specific sets of sub-elements from tuple or list, we use this unique function called slicing. Slicing is not only applicable to tuple but also for array and list.

x = ("a", "b","c", "d", "e")
print(x[2:4])


The output of this code will be (ā€˜c’, ā€˜d’).

šŸ”— Read Online

#Python #python_3
āž–āž–āž–āž–āž–āž–āž–āž–āž–āž–āž–āž–āž–
Join @python_bds for more cool data science materials.
*This channel belongs to @bigdataspecialist group
What will be the output of the following Python code snippet?
Anonymous Quiz
25%
abcd
37%
ABCD
35%
error
3%
none
ā¤3
Top Python Modules
šŸ‘9
What will be the output of the following Python code snippet?
Anonymous Quiz
29%
a
13%
abcd abcd abcd
47%
a a a a
11%
none
ā¤1šŸ‘1
What will be the output of the following Python code snippet?
Anonymous Quiz
12%
a
35%
abcd abcd abcd abcd
34%
a a a a
18%
none
šŸ‘2ā¤1
What will be the output of the following Python code?
Anonymous Quiz
29%
1 2 3
32%
123
33%
error
7%
none
ā¤2šŸ‘1šŸ”„1