100 Skills to Better Python.pdf

(2998 KB) Pobierz
Preface:
As a beginner in programming, often one way or another, we stumble across
Python as a go-to multifunctional powerhouse. Like the other languages, we also
see that there is no prescribed course that will guarantee you to be a successful
Python programmer. Our aim was to build a workbook that would be conducive
to a programmer’s journey of learning. In this book you will find everything that
two experienced Python professionals feel is essential for a well-rounded, in-
depth perception of the language. Although not everything can be covered no
matter the given time, we attempt to cover a wide variety of Python essentials in
this workbook. You will find that the exemplary programs make best use of
numerous Python functions and methodologies such that topics are not repeated.
Although you will find a brief explanation of the functions, feel free to utilize
the wide range of resources offered throughout the internet keeping in mind
there is never only one way to solve a problem. This book will not cover the
basics such as the syntax, structure, etc. as you can easily find clear explanations
everywhere. Welcome to the world of Python. Let’s get started.
Prerequisites:
-Python 3.6 downloaded and installed on your local system
-A compiler (suggested use: eclipse, jupyter notebook)
-A text editor (suggested use: sublime text, atom)
-Knowledge of the syntax and structure of Python 3
Introduction:
All the programs and tips mentioned in this book are tested in Python 3.6.
In the program section, we introduce three levels of difficulty: Beginner (20),
Intermediate (20), Advance (20). These will cover the most essential topics in
the world of Python 3. The next section will cover tips and tricks to make your
Python code shorter, faster and more efficient. This will be followed by a
comprehensive explanation of essential modules and packages offered by either
Python or 3rd party open source organizations. For your own betterment, try to
understand, type and implement all that you learn instead of reading through the
examples.
Table of Contents:
->50 programs of varied difficulty
(i)20 Beginner programs
(ii)20 Intermediate programs
(iii)10 Advance programs
->30 python3 tips and tricks
->20 Explanations of available modules
Beginner:
These are beginner concepts you should have at the tip of your fingers.
Good luck.
1. With a given number n, write a program to generate a dictionary that
contains (i, i*i) such that i is an number between 1 and n (both included). and
then the program should print the dictionary.
2. Write a program which accepts a sequence of comma-separated
numbers from console/user and generates a list and a tuple which contains every
number.
3. Write a program which will find all the numbers which are divisible by
7 but are not a multiple of 5, between 1000 and 1500 (both included). The
numbers obtained should be printed in a comma-separated sequence on a single
line.
4. Define a function which can compute the sum of two numbers.
5. Define a function that can receive two integral numbers in string form
and compute their sum and then print it in console.
Zgłoś jeśli naruszono regulamin