Python tricks and tips
Section 2: Strings
Lesson 8: Creating a single string
Code snippet to copy:
Join @python_programming_resources for more
𝗘𝗡𝗝𝗢𝗬 𝗟𝗘𝗔𝗥𝗡𝗜𝗡𝗚👍👍
Section 2: Strings
Lesson 8: Creating a single string
Code snippet to copy:
a = [“I”, “am”, “not”, “available”]
print(“ “.join(a))Join @python_programming_resources for more
𝗘𝗡𝗝𝗢𝗬 𝗟𝗘𝗔𝗥𝗡𝗜𝗡𝗚👍👍
Python tricks and tips
Section 2: Strings
Lesson 10: Checking if two words are anagrams
Code snippet to copy:
from collections import Counter
def is_anagram(str1, str2):
return Counter(str1) == Counter(str2)
print(is_anagram(‘taste’, ‘state))
print(is_anagram(‘beach’, ‘peach’))
Join @python_programming_resources for more
𝗘𝗡𝗝𝗢𝗬 𝗟𝗘𝗔𝗥𝗡𝗜𝗡𝗚👍👍
Section 2: Strings
Lesson 10: Checking if two words are anagrams
Code snippet to copy:
from collections import Counter
def is_anagram(str1, str2):
return Counter(str1) == Counter(str2)
print(is_anagram(‘taste’, ‘state))
print(is_anagram(‘beach’, ‘peach’))
Join @python_programming_resources for more
𝗘𝗡𝗝𝗢𝗬 𝗟𝗘𝗔𝗥𝗡𝗜𝗡𝗚👍👍
Python Frameworks and Libraries
Django is the most popular framework among Python developers. No surprise here, seeing how Web development is so popular among Python users. Interestingly, 43% of respondents are using IPython, which clearly shows it’s being used not only for scientific purposes, but for general software development as well.
A large number of respondents also specified Flask as their framework of choice.
Join @python_programming_resources for more
𝗘𝗡𝗝𝗢𝗬 𝗟𝗘𝗔𝗥𝗡𝗜𝗡𝗚👍👍
Django is the most popular framework among Python developers. No surprise here, seeing how Web development is so popular among Python users. Interestingly, 43% of respondents are using IPython, which clearly shows it’s being used not only for scientific purposes, but for general software development as well.
A large number of respondents also specified Flask as their framework of choice.
Join @python_programming_resources for more
𝗘𝗡𝗝𝗢𝗬 𝗟𝗘𝗔𝗥𝗡𝗜𝗡𝗚👍👍
Python tricks and tips
Section 3: Matrix
Lesson 11: Transposing a matrix
Code snippet to copy:
mat = [[8, 9, 10], [11, 12, 13]]
new_mat=zip(*mat)
for row in new_mat:
print(row)
Join @python_programming_resources for more
𝗘𝗡𝗝𝗢𝗬 𝗟𝗘𝗔𝗥𝗡𝗜𝗡𝗚👍👍
Section 3: Matrix
Lesson 11: Transposing a matrix
Code snippet to copy:
mat = [[8, 9, 10], [11, 12, 13]]
new_mat=zip(*mat)
for row in new_mat:
print(row)
Join @python_programming_resources for more
𝗘𝗡𝗝𝗢𝗬 𝗟𝗘𝗔𝗥𝗡𝗜𝗡𝗚👍👍
Python Notes
📄 40 pages
🔗 Book link
#Python
➖➖➖➖➖➖➖➖➖➖➖➖➖
Join @python_programming_resources for more
𝗘𝗡𝗝𝗢𝗬 𝗟𝗘𝗔𝗥𝗡𝗜𝗡𝗚👍👍
📄 40 pages
🔗 Book link
#Python
➖➖➖➖➖➖➖➖➖➖➖➖➖
Join @python_programming_resources for more
𝗘𝗡𝗝𝗢𝗬 𝗟𝗘𝗔𝗥𝗡𝗜𝗡𝗚👍👍
Python tricks and tips
Section 6: Dictionary
Lesson 13: Inverting the Dictionary
Code snippet to copy:
dict1={‘a’: 1, ‘b’: 2,‘c’: 3,‘d’: 4,‘e’: 5,‘f’: 6, ‘g’: 7}
dict2={v: k for k, v in dict1.items()}
print(dict2)
Join @python_programming_resources for more
𝗘𝗡𝗝𝗢𝗬 𝗟𝗘𝗔𝗥𝗡𝗜𝗡𝗚👍👍
Section 6: Dictionary
Lesson 13: Inverting the Dictionary
Code snippet to copy:
dict1={‘a’: 1, ‘b’: 2,‘c’: 3,‘d’: 4,‘e’: 5,‘f’: 6, ‘g’: 7}
dict2={v: k for k, v in dict1.items()}
print(dict2)
Join @python_programming_resources for more
𝗘𝗡𝗝𝗢𝗬 𝗟𝗘𝗔𝗥𝗡𝗜𝗡𝗚👍👍
Get all Off Campus Job alerts, internship updates, interview material regularly here 👇
@jobsandinternshipsupdates
@jobsandinternshipsindia
@jobsandinternshipsupdates
@jobsandinternshipsindia
Python tricks and tips
Section 6: Dictionary
Lesson 14: Iterating value pairs and dictionary keys
Code snippet to copy:
dict1={‘a’: 1, ‘b’: 2, ‘c’: 3, ‘d’: 4, ‘e’: 5, ‘f’: 6}
for a, b in dict1.iteritems():
print (‘{: {}’.format(a,b))
Join @python_programming_resources for more
𝗘𝗡𝗝𝗢𝗬 𝗟𝗘𝗔𝗥𝗡𝗜𝗡𝗚👍👍
Section 6: Dictionary
Lesson 14: Iterating value pairs and dictionary keys
Code snippet to copy:
dict1={‘a’: 1, ‘b’: 2, ‘c’: 3, ‘d’: 4, ‘e’: 5, ‘f’: 6}
for a, b in dict1.iteritems():
print (‘{: {}’.format(a,b))
Join @python_programming_resources for more
𝗘𝗡𝗝𝗢𝗬 𝗟𝗘𝗔𝗥𝗡𝗜𝗡𝗚👍👍
Get all Off Campus Job alerts, internship updates, interview material regularly here 👇
@jobsandinternshipsupdates
@jobsandinternshipsindia
@jobsandinternshipsupdates
@jobsandinternshipsindia
Python_Notes_Basics_of_Python_programmin.pdf
83.8 KB
Python Notes Basics of Python programming
📄 29 pages
#Python
➖➖➖➖➖➖➖➖➖➖➖➖➖
Join @python_programming_resources for more
𝗘𝗡𝗝𝗢𝗬 𝗟𝗘𝗔𝗥𝗡𝗜𝗡𝗚👍👍
📄 29 pages
#Python
➖➖➖➖➖➖➖➖➖➖➖➖➖
Join @python_programming_resources for more
𝗘𝗡𝗝𝗢𝗬 𝗟𝗘𝗔𝗥𝗡𝗜𝗡𝗚👍👍
Python tricks and tips
Section 6: Dictionary
Lesson 15: Merging multiple dictionaries
Code snippet to copy:
x = {'a': 1, 'b': 2}
y = {'b': 3, 'c': 4}
z = {x, y}
print(z)
Join @python_programming_resources for more𝗘𝗡𝗝𝗢𝗬 𝗟𝗘𝗔𝗥𝗡𝗜𝗡𝗚👍👍
Chaining Of Comparison Operators
Code snippet to copy:
True
False
Join @python_programming_resources for more
𝗘𝗡𝗝𝗢𝗬 𝗟𝗘𝗔𝗥𝗡𝗜𝗡𝗚👍👍
Code snippet to copy:
n = 10
result = 1 < n < 20
print(result)
result = 1 > n <= 9
print(result)
Output:True
False
Join @python_programming_resources for more
𝗘𝗡𝗝𝗢𝗬 𝗟𝗘𝗔𝗥𝗡𝗜𝗡𝗚👍👍
Python tricks and tips
Section 2: Strings
Lesson 8: Printing out multiple values of strings
Code snippet to copy:
print(“on”*3+’ ‘+”off”*2)
Join @python_programming_resources for more
𝗘𝗡𝗝𝗢𝗬 𝗟𝗘𝗔𝗥𝗡𝗜𝗡𝗚👍👍
Section 2: Strings
Lesson 8: Printing out multiple values of strings
Code snippet to copy:
print(“on”*3+’ ‘+”off”*2)
Join @python_programming_resources for more
𝗘𝗡𝗝𝗢𝗬 𝗟𝗘𝗔𝗥𝗡𝗜𝗡𝗚👍👍
𝗧𝗵𝗼𝘀𝗲 𝘄𝗮𝗻𝘁 𝘁𝗼 𝗽𝗿𝗮𝗰𝘁𝗶𝗰𝗲 𝗰𝗼𝗺𝗽𝗲𝘁𝗶𝘁𝗶𝘃𝗲 𝗽𝗿𝗼𝗴𝗿𝗮𝗺𝗺𝗶𝗻𝗴 𝗼𝗿 𝘄𝗮𝗻𝘁 𝘁𝗼 𝗽𝗮𝗿𝘁𝗶𝗰𝗶𝗽𝗮𝘁𝗲 𝗶𝗻 𝗰𝗼𝗺𝗽𝗲𝘁𝗶𝘁𝗶𝘃𝗲 𝗽𝗿𝗼𝗴𝗿𝗮𝗺𝗺𝗶𝗻𝗴 𝗰𝗼𝗻𝘁𝗲𝘀𝘁𝘀 𝗷𝗼𝗶𝗻 𝘁𝗵𝗲𝘀𝗲 𝗯𝗲𝗹𝗼𝘄 𝗴𝗿𝗼𝘂𝗽𝘀👇👇.
𝟭. 𝗚𝗲𝗻𝗲𝗿𝗮𝗹 𝗗𝗶𝘀𝗰𝘂𝘀𝘀𝗶𝗼𝗻 𝗚𝗿𝗼𝘂𝗽:
@cp_discussion_group
@cp_coding_grp
@allcodingsolution_official
𝟮. 𝗟𝗘𝗘𝗧𝗖𝗢𝗗𝗘 𝗗𝗶𝘀𝗰𝘂𝘀𝘀𝗶𝗼𝗻 𝗚𝗿𝗼𝘂𝗽:
@leetcode_cp
𝟯. 𝗖𝗢𝗗𝗘𝗙𝗢𝗥𝗖𝗘𝗦 𝗗𝗶𝘀𝗰𝘂𝘀𝘀𝗶𝗼𝗻 𝗚𝗿𝗼𝘂𝗽:
@codeforces_cp
𝟰. 𝗖𝗢𝗗𝗘𝗖𝗛𝗘𝗙 𝗗𝗶𝘀𝗰𝘂𝘀𝘀𝗶𝗼𝗻 𝗚𝗿𝗼𝘂𝗽:
@codechef_group
𝟱. 𝗚𝗘𝗘𝗞𝗦𝗙𝗢𝗥𝗚𝗘𝗘𝗞𝗦 𝗗𝗜𝗦𝗖𝗨𝗦𝗦𝗜𝗢𝗡 𝗚𝗿𝗼𝘂𝗽:
@gfg_discuss
𝟭. 𝗚𝗲𝗻𝗲𝗿𝗮𝗹 𝗗𝗶𝘀𝗰𝘂𝘀𝘀𝗶𝗼𝗻 𝗚𝗿𝗼𝘂𝗽:
@cp_discussion_group
@cp_coding_grp
@allcodingsolution_official
𝟮. 𝗟𝗘𝗘𝗧𝗖𝗢𝗗𝗘 𝗗𝗶𝘀𝗰𝘂𝘀𝘀𝗶𝗼𝗻 𝗚𝗿𝗼𝘂𝗽:
@leetcode_cp
𝟯. 𝗖𝗢𝗗𝗘𝗙𝗢𝗥𝗖𝗘𝗦 𝗗𝗶𝘀𝗰𝘂𝘀𝘀𝗶𝗼𝗻 𝗚𝗿𝗼𝘂𝗽:
@codeforces_cp
𝟰. 𝗖𝗢𝗗𝗘𝗖𝗛𝗘𝗙 𝗗𝗶𝘀𝗰𝘂𝘀𝘀𝗶𝗼𝗻 𝗚𝗿𝗼𝘂𝗽:
@codechef_group
𝟱. 𝗚𝗘𝗘𝗞𝗦𝗙𝗢𝗥𝗚𝗘𝗘𝗞𝗦 𝗗𝗜𝗦𝗖𝗨𝗦𝗦𝗜𝗢𝗡 𝗚𝗿𝗼𝘂𝗽:
@gfg_discuss