Assignment: 18ESC108A Elements of Computer Science and Engineering B.Tech (ASE) Computer Science FET
Assignment: 18ESC108A Elements of Computer Science and Engineering B.Tech (ASE) Computer Science FET
i
Declaration Sheet
Student Name LIKITH S
Reg. No 18ETAS012017
Programme B.Tech(ASE) Semester/Year 2ND/2018
Course Code 18ESC108A
Course Title Elements of Computer science and Engineering
Course Date to
Course Leader
Declaration
Signature of the
Date
Student
Submission date
stamp
(by Examination & Assessment
Section)
Signature of the Course Leader and date Signature of the Reviewer and date
ii
Contents
____________________________________________________________________________
Imperative in which the programmer instructs the machine how to change its state,
Procedural which groups instructions into procedures,
Object-oriented which groups instructions together with the part of the state they operate on,
Declarative in which the programmer merely declares properties of the desired result, but not how
to compute it
Functional in which the desired result is declared as the value of a series of function applications,
Logic in which the desired result is declared as the answer to a question about a system of facts
and rules,
Mathematical in which the desired result is declared as the solution of an optimization problem
languages that fall into the imperative paradigm have two main features: they state the order in which
operations occur, with constructs that explicitly control that order, and they allow side effects, in which
state can be modified at one point in time, within one unit of code, and then later read at a different point
in time inside a different unit of code. The communication between the units of code is not explicit.
Meanwhile, in object-oriented programming, code is organized into objects that contain state that is only
modified by the code that is part of the object. Most object-oriented languages are also imperative
languages.
In contrast, languages that fit the declarative paradigm do not state the order in which to execute
operations. Instead, they supply a number of operations that are available in the system, along with the
conditions under which each is allowed to execute. The implementation of the language's execution model
tracks which operations are free to execute and chooses the order on its own.
in functional programming, programs are treated as a sequence of stateless function evaluations. When
programming computers or systems with many processors, in process-oriented programming, programs
are treated as sets of concurrent processes acting on logically shared data structures.
Conclusion
As you can see each programming paradigm has pros and cons. Furthermore, in my opinion, by designing
the program architecture carefully, disadvantages of one paradigm can be overcome. In other words, you
don’t have to worry about what paradigm would be better to program in Python (at least it supports most
of paradigms you can use of). You can mix match several paradigms to code a single program, or it is
completely fine to stick with one that is the most familiar to you. However, no matter which strategy you
are applying, there are other things that are waaaay more important: 1. nice documentations, 2. codes
with high readability and 3. pleasant communications to work efficiently with others who also program on
the same code as yours.
<Subject Title> 5
Question No. B1
<Subject Title> 6
Solution to the question.B1.2:-
Implemented algorithm program in Python programming language.
#input
<Subject Title> 7
#Output
<Subject Title> 8
Solution to the question.B1.4:-
When option 1 is entered, it asks for the item. When pant is given, it asks for number of items. When it is
given as 3, it again asks to enter option. 1 is entered, python asks for item. Sweat shirt is entered. It asks for
quantity and after that it again asks for option. When given 4, it checks the items in shopping cart and
generates a bill. It calculates tax separately and finally adds its it to the sum and prepares a bill of Rs. 920.
Finally, it prints, Thank you!
<Subject Title> 9
Question No. B2
Solution to Question No. B2:
Solution to the question B2.1:
Algorithm for the given problem specification.
Step 1: Start
Step 2: Create a dictionary (my_dict) containing name of the items as key and item ID as value
Step 3: Sort the dictionary using sorted() built in function
Step 4: Assign the key of the sorted dictionary to a variable named A, as A = sorted(my_dict)
Step 5: Display A
Step 6: Select name of the text file where you have to perform writing action. It is done with
command with open likith.csv’w’ filehandle:
Step 7: Traverse through A, using for loop as for listitem in A:
Step 8: Insert strings present in A, in a single line in the text file using the command
filehandle.write
Step 9: Display writing is completed
Step 10: Close the file and free the memory space acquired by the file using the command
filehandle.close()
Step 11: Stop
#output
<Subject Title> 10
1.Excel output 2.Text output
<Subject Title> 11