1
0
Fork
You've already forked Python
0
Python Learning scripts and projects from Hyperskill.
  • Python 100%
Find a file
2023年03月27日 16:59:07 +01:00
automate_the_boring_stuff project upload 2020年05月31日 17:53:43 +01:00
bill_splitter Project Bill Splitter 2021年05月18日 22:37:38 +01:00
credit_calculator Credit Calculator hyperskill project 2020年11月11日 23:41:03 +00:00
currency_converter Currency Converter. Python Hyperskill. 2021年03月14日 10:57:16 +00:00
duplicate_file_handler Duplicate File Handler Project. Python Track Hyperskill 2023年02月28日 16:55:16 +00:00
generating_randomness Generating Randomness 2021年06月06日 17:01:42 +01:00
honest_calc Honest Calculator project 2021年12月19日 16:09:24 +00:00
intro_python_dev project upload 2020年05月31日 17:53:43 +01:00
last_pencil Last Pencil Game from JetBrains Academy 2023年02月22日 13:11:11 +00:00
markdown_editor Markdown Editor. Hyperskill. Medium Difficulty 2023年03月27日 16:59:07 +01:00
numeric_matrix_calculator Numeric Matrix Processor 2021年02月21日 09:35:14 +00:00
rock_paper_scissors Rock Paper Scissors. Medium Level Project 2020年12月30日 21:20:45 +00:00
simple_banking_system Simple Banking System 2020年12月02日 17:38:13 +00:00
text_adventure_game Text Adventure Game Project 2021年05月16日 09:01:48 +01:00
tic_tac_toe TicTacToe project from Hyperskill 2020年11月11日 21:42:22 +00:00
.gitignore Initial commit 2020年05月31日 18:07:39 +02:00
LICENSE Initial commit 2020年05月31日 18:07:39 +02:00
README.md 2 new topics 2020年12月19日 01:55:52 +00:00

Python Developer Hyperskill Course

Simple Programs

Introduction to Python


Python is a modern general-purpose programming language designed to be easy to learn and use in practice. Python has a wide range of possible applications, especially in:

  • web development
  • data science (including machine learning)
  • scripting (task automation, e.g. text processing or a simulation of typical user actions)

Less commonly, it is also used in desktop development.

Example

Code that prints Learn Python to be great!

print("Learn Python to be great!")

Overview of the basic program


Hello, World! example

print("Hello, World!")

print is the name of a function. A function is a block of code that does something useful. To include quotes in a string it must be enclosed in quotes of another type.

print("Yes, I'm ready to learn Python.")

Possible errors

  • Extra indentation
  • Calling function by wrong name
  • Writing names in wrong case
  • Missing one or both quotes for a string
  • Missing one or more parentheses

Multi-line programs


The print function allows to print an empty line with no string specified.

Program execution


Python is an interpreted language. At a high level, program execution is like this:

Writing a script ---> Interpretation ---> Everything works!

The interpreter is the software that "reads" the program and executes the code line by line from top to bottom. It is a part of the standard library with all built-in modules, functions, data, etc. The default interpreter for Python is written in C and is called CPython. PyPy (Restricted Python), Jython (Java) and IronPython (.Net) are other available interpreters.

Interpretation consists of 3 steps; compilation, byte-code and virtual machine. The compiler turns code into byte-code. Byte-code is lower level, platform-independent and a more efficient version of the code. It is not binary machine code, but Python-specific representation of source code. This is the reason Python is slower than traditional compiled languages.

After compilation, the byte-code is given to the PVM (Python Virtual Machine). which runs the byte-code.

Introduction to Python shell


The interactive shell is a real-time Python interpreter. IDLE is a simple graphic interface for Python Shell.

Taking input


The input() function waits for a value to be entered by the user, it reads it and returns it in a program as a string. Recommended to state clearly what type of input is expected. For example, input() can take an optional argument for this: input('Please, enter your name: ') (input is printed in new line) but it can also be printed with the print()function (input is printed in the same line)

Program with numbers