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, Jul 2020 compared to a year ago:

Rank Change Language Share Trend
1 Python 31.73 % +3.9 %
2 Java 17.13 % -2.7 %
3 Javascript 7.98 % -0.3 %
4 C# 6.67 % -0.6 %
5 up arrow C/C++ 5.93 % +0.1 %
6 down arrow PHP 5.64 % -1.1 %
7 R 4.14 % +0.3 %
8 Objective-C 2.61 % -0.1 %
9 Swift 2.29 % -0.1 %
10 up arrow TypeScript 1.91% +0.2 %
11 down arrow Matlab 1.74 % -0.1 %
12 up arrow Kotlin 1.62 % +0.2 %
13 up arrow Go 1.37 % +0.2 %
14 VBA 1.27 % -0.0 %
15 down arrow Ruby 1.26 % -0.1 %
16 Scala 0.99 % -0.1 %
17 Visual Basic 0.83 % -0.2 %
18 up arrow Rust 0.81 % +0.3 %
19 up arrow Dart 0.52 % +0.2 %
20 up arrow Ada 0.47 % +0.1 %
21 up arrow Lua 0.46 % +0.1 %
22 down arrow Abap 0.46 % -0.1 %
23 down arrow Groovy 0.43 % -0.1 %
24 down arrow Perl 0.42 % -0.2 %
25   Cobol 0.41 % +0.1 %
26 up arrow Julia 0.37 % +0.1 %
27 down arrow Haskell 0.29 % +0.0 %
28 down arrow Delphi 0.25 % -0.0 %

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

TIOBE Index for July 2020

Jul 2020 Jul 2019 Change Programming Language Ratings Change
1 2 up arrow C 16.45% +2.24%
2 1 down arrow Java 15.10% +0.04%
3 3 Python 9.09% -0.17%
4 4 C++ 6.21% -0.49%
5 5 C# 5.25% +0.88%
6 6 Visual Basic 5.23% +1.03%
7 7 JavaScript 2.48% +0.18%
8 20 up arrow R 2.41% +1.57%
9 8 down arrow PHP 1.90% -0.27%
10 13 up arrow Swift 1.43% +0.31%
11 9 down arrow SQL 1.40% -0.58%
12 16 up arrow Go 1.21% +0.19%
13 12 down arrow Assembly language 0.94% -0.45%
14 19 up arrow Perl 0.87% -0.04%
15 14 down arrow MATLAB 0.84% -0.24%
16 11 down arrow Ruby 0.81% -0.83%
17 30 up arrow Scratch 0.72% +0.35%
18 33 up arrow Rust 0.70% +0.36%
19 23 up arrow PL/SQL 0.68% -0.01%
20 17 down arrow Classic Visual Basic 0.66% -0.35%

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

Python: How do I copy a file in Python?

shutil has many methods you can use. One of which is:

from shutil import copyfile
copyfile(src, dst)
  • Copy the contents of the file named src to a file named dst.
  • The destination location must be writable; otherwise, an IOError exception will be raised.
  • If dst already exists, it will be replaced.
  • Special files such as character or block devices and pipes cannot be copied with this function.
  • With copy, src and dst are path names given as strings.

If you use os.path operations, use copy rather than copyfile. copyfile will only accept strings.

Ref: https://bit.ly/3e2Y1G0