Skip to main content

Python Introduction

 What is Python?

Python is a popular programming language. It was created by Guido van Rossum, and released in 1991.


It is used for:

  • web development (server-side),
  • software development (mobile & desktop),
  • mathematics,
  • system scripting.


What can Python do?

  • Python can be used on a server to create web applications.
  • Python can be used alongside software to create workflows.
  • Python can connect to database systems. It can also read and modify files.
  • Python can be used to handle big data and perform complex mathematics.
  • Python can be used for rapid prototyping, or for production-ready software development.


Why Python?

  • Python works on different platforms (Windows, Mac, Linux, Raspberry Pi, etc).
  • Python has a simple syntax similar to the English language.
  • Python has syntax that allows developers to write programs with fewer lines than some other programming languages.
  • Python runs on an interpreter system, meaning that code can be executed as soon as it is written. This means that prototyping can be very quick.
  • Python can be treated in a procedural way, an object-oriented way or a functional way.


Good to know

The most recent major version of Python is Python 3, which we shall be using in this tutorial. However, Python 2, although not being updated with anything other than security updates, is still quite popular.


It is possible to write Python in an Integrated Development Environment, such as Thonny, Pycharm, Netbeans or Eclipse which are particularly useful when managing larger collections of Python files.


Python Syntax compared to other programming languages

  • Python was designed for readability, and has some similarities to the English language with influence from mathematics.
  • Python uses new lines to complete a command, as opposed to other programming languages which often use semicolons or parentheses.
  • Python relies on indentation, using whitespace, to define scope; such as the scope of loops, functions and classes. Other programming languages often use curly-brackets for this purpose.


Example

Our first program will be

print("Hello, YOUR NAME")

i.e print('Hello, Daniel')

Output:

    Hello Daniel

Comments

Popular posts from this blog

Mathematics - Probability

-PROBABILITY = Number of POSSIBLE EVENT Number of TOTAL OUTCOME   Question 1 Teams P and Q are involved in a game of football. What is the probability that the game ends in a draw? Options A) ⅔ B) ½ C) ⅓ D) ¼ Solution: In a football game, one team either wins or there is a tie. This means there are three possible outcomes: a win, a loss or a draw. Therefore, the probability of a draw is ⅓ The correct answer is C. Question 2 Given distribution of color beads: blue, black, yellow, white and brown with frequencies 1, 2, 3, 4 and 5 respectively. Find the probability that a bead picked at random will be blue or white. Options A) 7/15 B) 2/5 C) 1/3 D) 1/15 Solution: Total number of beads = 15. Number of white beads = 4. ⇒P(white) = 4/15 Number of blue beads = 1. ⇒P(blue) = 1/15 P(white or blue) = P(white) + P(blue) =5/15 🔶P(white or blue) = ⅓ The correct answer is C. Question 3 A die is rolled, find the probability that an even number is obtained. Options A. ⅙ B. ¼ C. ⅓ D. ½ Solution...

English - Grammatical Concord

Definition: Concord is the relationship between a subject and its verb, or between a number or determiner and its noun; e.g. I look/she looks… one bell/three bells. It is also called concord. Concord can also be seen as the relationship between words in gender, number, case, person, or any other grammatical category which affects the forms of the words. Concord, as it is also often referred to, mainly focuses on subject-verb agreement. This is subdivided into three categories: Grammatical concord Concord of proximity Notional concord "Some Rules for Grammatical Concord" The grand rule of subject-verb concord is that a singular subject takes a singular verb and a plural subject takes a plural verb. And it is needful to establish this fact that singular verbs are inflected with suffix ‘-s’ while plural verbs maintain the base form. In other words, a singular verb ends with an ‘s’ and a plural verb has no ‘s’. Verb Singular   •     Plural comes     ...

Physics - Scalers and Vectors

  Introduction to Vectors and Scalars We come into contact with many physical quantities in the natural world on a daily basis. For example, things like time, mass, weight, force, and electric charge, are physical quantities with which we are all familiar. We know that time passes and physical objects have mass. Things have weight due to gravity. We exert forces when we open doors, walk along the street and kick balls. We experience electric charge directly through static shocks in winter and through using anything which runs on electricity. There are many physical quantities in nature, and we can divide them up into two broad groups called vectors and scalars. Scalars and Vectors Scalars are physical quantities which have only a number value or a size (magnitude). A scalar tells you how much of something there is. Definition: Scalar A scalar is a physical quantity that has only a magnitude (size). For example, a person buys a tub of margarine which is labelled with a mass of 500g....