by Saurabh Mudgal for IEEE NTU Student Branch
Disclaimer: This document is meant to serve as a reference for the attendees of IEEE Python Workshop 2018. It does not cover all concepts and implementations discussed in the workshop.
Welcome to a condensed introduction to Python 3. Kindly, refer to Installing_Python3.md
since you'll need to install python 3 on your devices before you can start learning coding. For improved understanding, it's recommended that while reading through this document you read Script.md
simultaneously. Following is the output for the code:
Welcome to IEEE Python Workshop 2018 edition. It's my pleasure to conduct today's workshop for you.
My name is Saurabh Mudgal.
I am 19.0 years old and am majoring in mechanical engineering.
If you wish to display the aforementioned output as text on the computer screen the following python code should be written and executed:
age = 5+(8%3)-3+(3*10)/2
greetings = 'Welcome to IEEE Python Workshop 2018 edition. It's my pleasure to conduct today's workshop for you.'
name = 'Saurabh Mudgal'
major = 'mechanical engineering'
print(greetings)
print('My name is ' + name + '.')
print('I am ' + str(age) + ' years old and am majoring in ' + major + '.')
There are two main pre-defined types of variables (although python alows you to create your own variable types):
- Numeric types
- String types
- Bool types
- Sequence types
a = 9 # a is numeric type
b = 9.12 # b is numeric type
c = 3/2 # c is numeric type
d = 'Apple' # d is string type
e = 'Goodevening! Nice to meet you' # e is string type
What is Syntax?
In python, syntax refers to the rules that specify the correct combined sequence of symbols that can be used to form a correctly structured program using python. Programmers communicate with computers through the correctly structured syntax, semantics and grammar of the programming language (In our case, python).
Statement: Each line of code in a Python program is called a statement. Python interprets statements and runs them one by one.
Comments: The #
symbol indicates a comment and anything after #
is ignored by the computer. Comments provide information to improve code readability.
Built-in Functions: Python comes with many built-in functions like print()
& input()
to help you in writing your code.
- It sends detailed and exact instructions to the computer which are needed to solve a specific problem.
- These instructions are written using a programming language like python.
- Computers can only communicate in binary language.
- An integrated development environment (IDE) is a software application that provides comprehensive facilities to computer programmers for software development.
- We are using Komodo Edit 11.
- IDE process cycle - compile, link and debug
- IDE links libraries to the code.
- Libraries give codes access to vast pre-defined functions and classes.
- Work of coders is stored in libraries for use in future codes.
# Below is an example of a library. This is a code to display the version of the python software
import platform
print('This is python version ' + str(platform.python_version())
- Python is a tool at the disposal of human beings to interact with the computers and machinery.
- Python is a mediater language.
- Python is known for its remarkable power yet a readable syntax.
- It is one of the easiest programming languages to learn but is also one of the most powerful languages, used heavily in machine learning and data science.
- Python was developed in the 1980s by Dutch programmer Guido van Russom
- There's a core philosophy behind the Python language, which includes the following statements:
- Beautiful is better than ugly.
- Explicit is better than implicit.
- Simple is better than complex.
- Readability counts.
- Python 3 isn't backward compatible. It is very different from earlier versions.
Python has potential applications in an array of fields:
Python is a widely popular platform for developing surveying softwares and data analysis.
a = int(input('Enter your content with the workshop content (On a scale 1-10): '))
print('The workshop is ' + str(10*a) + '% effective.')
In addition to the arithmetic operators, python also has a large set of mathmatical functions and tabulation features that it can apply to organise data.
Limitation of python code:
x = 0.1 + 0.1 + 0.1 - 0.3
print("x = " + str(x))
x = 5.551115123125783e-17
Alternative solution/ Improvement to the code:
from decimal import *
a = Decimal('0.10')
b = Decimal('0.30')
x = a + a + a - b
print('x = ' + str(x))
x = 0
- account management
- insurance
- payment processing
- regulation
- capital markets