A. Three Features That I Like in Python: CS320 - Assignment 01 1751048 - Khuu Kien An
A. Three Features That I Like in Python: CS320 - Assignment 01 1751048 - Khuu Kien An
Question 1:
I choose Python
1. Object-oriented:
Python supports object oriented language and concepts of classes and objects come into existence.
Python has a large and broad library and prvides rich set of module and functions for rapid application
development.
3. Free and open source: Python language is freely available at offical web address.The source-code is
also available. Therefore it is open source.
Extensible: You can write some of your Python code in other languages like C++. This makes Python an
extensible language, meaning that it can be extended to other languages.
b. Feature I would like to add in Python is speed. Because Python is not strong about the time
processing.
c. Criterias:
Readability: One of the things that has made Python successful is its readability. Code is clear
and easy to understand. One of the reasons is that Python uses words for a few things that
other languages use symbols. It makes your code simple. The syntax is easy to learn. For
example, you can clearly define variable “stuff” like this:
stuff = "motorbike":
Writability: Python can be used for an embedded controller. Abstraction in Python is achieved
by using abstract classes and interfaces. An abstract class is a class that generally provides
incomplete functionality and contains one or more abstract methods. Abstract methods are the
methods that generally don’t have any implementation, it is left to the sub classes to provide
implementation for the abstract methods. And Python is an expressive language. Expressive in
this context means that a single line of Python code can do more than a single line of code in
most other languages. We can swap the value of variables like this in Python:
var2, var1 = var1, var2
Reliability: Python’s reliability lies in its secure environment, availability of reliable resources,
and availability of strong support community in the industry.
Ease of Code Reuse and Maintance: You can maintain easily Python code because it is supported
by many libraries, and the writability makes it shorter than C++, and Java.
Question 3:
Operator: Assign operator “=”, Unary operator “++”, Relational operator “<”
Literal: “\n”,
Values:
+ Iter = 0
Question 4:
Question 5:
Prolog is a declarative language meaning that rather than describing how to compute a solution,
a program consists of a data base of facts and logical relationships (rules) which describe the
relationships which hold for the given application. Rather then running a program to obtain a
solution, the user asks a question. When asked a question, the run time system searches
through the data base of facts and rules to determine (by logical deduction) the answer.
A Prolog program consists of a database of facts and rules, and queries (questions). Variables:
must begin with an upper case letter. Constants: numbers, begin with lowercase letter, or
enclosed in single quotes
Unification. The way in which Prolog matches two terms is called unification. ... The unification
algorithm in Prolog is roughly this: df:un Given two terms and which are to be unified: If and are
constants (i.e. atoms or numbers) then if they are the same succeed.