problem solving-python-IDE
problem solving-python-IDE
UPC: 2342011101
PROBLEM SOLVING
A problem can be defined as a gap between the actual and desired conditions
Methodology of Problem Solving
• Algorithms is a set of instructions used for solving a
problem in a step-by-step manner.
• A pseudo code is used to state an algorithm in an
English-like syntax
• A flow chart is a simple diagram that illustrates a
sequence of operations to be performed for obtaining
solution to a problem
Background on Python
⚫ Python was developed by Guido van Rossum in
the late eighties and early nineties at the National
Research Institute for Mathematics and Computer
Science in the Netherlands.
⚫ Python is derived from many other languages,
including ABC, Modula-3, C, C++, Algol-68,
SmallTalk, and Unix shell and other scripting
languages.
⚫ Python is copyrighted. Like Perl, Python source
code is now available under the GNU General
Public License (GPL).
Introduction to Python
⚫ High-level,
⚫ Interpreted
⚫ Interactive
⚫ Object-oriented
⚫ Scripting language
⚫ Portable
⚫ Extendable
⚫ Case-sensitive
Starting with Python
⚫ Install python
⚫ Open using python or IDLE (integrated development
environment in ubuntu)
⚫ Multiple python versions may be installed
− ls /usr/bin/python* lists different versions of python installed
on system
⚫ Check default python version
− At command line $ python -V result may be 3.4.12
− Or in script type
⚫ Import sys
⚫ Print sys.version
How does Python code execute?
Running a python program on
UBUNTU
⚫ Interactive mode
− Start python and type command at prompt >>>
⚫ Script mode
− Save code/instructions in a file with extension .py (e.g. p1.py)
⚫ First way : Change to directory where python file is stored
− Type python3 p1.py and press enter
⚫ Second way: change to executable permission of the file by
− Chmod +x p1.py
− Run as ./p1.py (also include line in python file to indicate which interpreter)