w3resource

Python Exercises, Practice, Solution

What is Python language?

Python is a widely used high-level, general-purpose, interpreted, dynamic programming language. Its design philosophy emphasizes code readability, and its syntax allows programmers to express concepts in fewer lines of code than possible in languages such as C++ or Java.

Python supports multiple programming paradigms, including object-oriented, imperative and functional programming or procedural styles. It features a dynamic type system and automatic memory management and has a large and comprehensive standard library

The best way we learn anything is by practice and exercise questions. We have started this section for those (beginner to intermediate) who are familiar with Python.

Hope, these exercises help you to improve your Python coding skills. Currently, following sections are available, we are working hard to add more exercises .... Happy Coding!

List of Python Exercises :

Python Challenges :

Python Mini Projects :

Python GUI tkinter

Python NumPy :

Python Pandas :

Python Exercises

Python BeautifulSoup :

Python Web Scraping :

Python Natural Language Toolkit :

Python Arrow Module :

Python GeoPy Package :

More...

Note : Download Python from https://www.python.org/ftp/python/3.2/ and install in your system to execute the Python programs. You can read our Python Installation on Fedora Linux and Windows 7, if you are unfamiliar to Python installation.
You may accomplish the same task (solution of the exercises) in various ways, therefore the ways described here are not the only ways to do stuff. Rather, it would be great, if this helps you anyway to choose your own methods.

List of Exercises with Solutions :

Popularity of Programming Language
Worldwide, Jun 2020 compared to a year ago:

Rank Change Language Share Trend
1 Python 31.6 % +4.3 %
2 Java 17.67 % -2.4 %
3 Javascript 8.02 % -0.2 %
4 C# 6.87 % -0.4 %
5 PHP 6.02 % -0.9 %
6 C/C++ 5.69 % -0.2 %
7 R 3.86 % -0.1 %
8 Objective-C 2.5 % -0.3 %
9 Swift 2.24 % -0.1 %
10 up arrow TypeScript 1.86% +0.2 %
11 down arrow Matlab 1.72 % -0.2 %
12 up arrow Kotlin 1.54 % +0.2 %
13 up arrow Go 1.29 % +0.2 %
14 VBA 1.24 % -0.1 %
15 down arrow Ruby 1.23 % -0.1 %
16 Scala 1.0 % -0.1 %
17 Visual Basic 0.88 % -0.2 %
18 up arrow Rust 0.78 % +0.2 %
19 up arrow Dart 0.5 % +0.2 %
20 down arrow Perl 0.46 % -0.1 %
21 down arrow Abap 0.45 % -0.1 %
22   Lua 0.44 % +0.1 %
23   Ada 0.43 % +0.1 %
24 down arrow Groovy 0.41 % -0.1 %
25 up arrow Julia 0.39 % +0.1 %
26 down arrow Cobol 0.37 % +0.1 %
27 down arrow Haskell 0.28 % -0.0 %
28 down arrow Delphi 0.27 % +0.0 %

Source : http://pypl.github.io/PYPL.html

TIOBE Index for June 2020

Jun 2020 Jun 2019 Change Programming Language Ratings Change
1 2 up arrow C 17.19% +3.89%
2 1 down arrow Java 16.10% +1.10%
3 3 Python 8.36% -0.16%
4 4 C++ 5.95% -1.43%
5 6 up arrow C# 4.73% +0.24%
6 5 down arrow Visual Basic 4.69% +0.07%
7 7 JavaScript 2.27% -0.44%
8 8 PHP 2.26% -0.30%
9 22 up arrow R 2.19% +1.27%
10 9 down arrow SQL 1.73% -0.50%
11 11 Swift 1.46% +0.04%
12 15 up arrow Go 1.02% -0.24%
13 13 Ruby 0.98% -0.41%
14 10 down arrow Assembly language 0.97% -0.51%
15 18 up arrow MATLAB 0.90% -0.18%
16 16 Perl 0.82% -0.36%
17 20 up arrow PL/SQL 0.74% -0.19%
18 26 up arrow Scratch 0.73% +0.20%
19 19 Classic Visual Basic 0.65% -0.42%
20 38 up arrow Rust 0.64% +0.38%

Source : https://www.tiobe.com/tiobe-index/

[ Want to contribute to Python exercises? Send your code (attached with a .zip file) to us at w3resource[at]yahoo[dot]com. Please avoid copyrighted materials.]



Python: Tips of the Day

Creates a dictionary with the same keys as the provided dictionary and values generated by running the provided function for each value

Example:

def tips_map_values(obj, fn):
  ret = {}
  for key in obj.keys():
    ret[key] = fn(obj[key])
  return ret
users = {
  'Owen': { 'user': 'Owen', 'age': 29 },
  'Eddie': { 'user': 'Eddie', 'age': 15 }
}

print(tips_map_values(users, lambda u : u['age'])) # {'Owen': 29, 'Eddie': 15}

Output:

{'Owen': 29, 'Eddie': 15}