Introduction to Computers and Programming (CSL101)  Ist Semester 2011-2012

(L-T-P structure : 3-0-2: 3 hours lecture, 2 hours lab)

 

Link to Web Page of Prof K K Biswas

 

 

Instructor Timings and Venue

Course Contents

Books Recommended

Evaluation Scheme

Attendance Policy

Help Sessions

Lab instructors & schedule

vi or pico editor command

Python

List of students

List of Class Committee Memebers

 

Unix_material |  VI Editor | 

Ass1 | Ass 2 | Ass3 | Ass4

Python_Files

 

Lectures by Prof Saroj Kaushik

 

Lectures by Prof K K Biswas

Lect_Module1_SK_ Introduction

Lect_Module1_KKB_Intro Python

Lect_Module2_SK_Algorithm

Lect_Module2_KKB_ Looping_Selection

Lect_Module3_SK_Efficiency

Lect_Module3_KKB_ Functs and Arrays

Lect_Module4_SK_Number System

Lect_Module4_KKB_ Lists and Strings

Lect_Module5_SK_String&Matrix Algorithms

Lect_Module5_KKB_ Directories and tuples in Python

Lect_Module6_Stack_Queues

Lect_Module6_KKB_ OOP1

Lect_Module7_Searching_sorting

Lect_Module7_KKB_ Class_Graphics

Lect_Module8_OOPs

Lect_Module8_KKB_ Graphics_Inheritence

Numerical Techniques

Lect_Module9_KKB_ Inheritence

Lect_Module9_C Programming

Lect_Module10_KKB_ Polymorphism

 

Lect_Module11_KKB_ Merge_sort

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Back

Instructors:

Prof.  Saroj Kaushik ,  Dept of Computer Science & Engineering,

Room No II-416 (Bharati Building). (Tel.No 1292 off)

Prof K K Biswas,  Dept of Computer Science & Engineering,

Room No II-313 (Bharati Building). (Tel.No 6010 off)

Venue  and Timings

Lectures:       

·        Monday Thursday (2 pm to 3.20pm)

Lab Classes: Computer Centre

Venue:           

   LT3, Block  IV

Back

 


 
 

 

 

 

 

 

 

 

 

 

 

 

 

 

Back
COURSE CONTENTS

Introduction to Computers, Introduction to Computer Problem Solving, Algorithm design issues, Program Design methods, Brief introduction to Python Programming language: Data representations, Number System, Conversion from one base to another, Complement representations of negative integers, Floating point representation, Advanced Features of Python.  Introduction to object oriented programming language

Back


 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Book References

  1. R.G. Dromey, "How to Solve it by Computer", Prentice Hall of India, 1992.

2.      Link to an online material on Python Programming: www.greenteapress.com/thinkpython/thinkpython.pdf

 

 

 Back
 

 

 

 

 

 

 

 

 

 

 

 

Reference Books

         For Algorithm:

        R. G. Dromey “How to solve it by computer”, Prentice Hall, Indian edition.

         Link to an online material on Python Programming:

www.greenteapress.com/thinkpython/thinkpython.pdf

Back

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Back

Attendance Policy

1.      You must attend all lecture and lab classes.

2.      Attendance will be taken on paper or using some device. Proxy if caught has strict consequence.

3.      If a student’s attendance in the course is less than 75%, he/she will be put under academic probation.

4.      If a student.s attendance is less than 75%; the student will be  awarded one grade less than the actual grade that he(she) has earned.  For example, a student who has got A grade but has attendance less than 75% will be awarded A- grade.

Back

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 


Evaluation:       

Back

·        Minor 1 and 2, each has 15% weight

·        Major - 40% weight

·        Quizzes and home assignments, 10%

·        Assignments and Lab work - 20% weight

Instructions:

5.      A student has to pass EACH of  the course components indicated above, by getting at least 30% in each.

6.      Student should get minimum 35% overall to pass the course.

7.      All assignments are to be done by individuals. If assignments are copied (two similar programs) then penalty is very heavy. You will get Fail grade.

8.      For each assignment there will be demo.

9.      Classes will begin on time and entry will not be allowed later than 5 minutes.

10.  Cheating in tests or assignments will result in ‘F’ grade in the course.

11.  Attend the “Special Help sessions” if  you have difficulty in the course.

12.  Keep meeting your TA ( Teaching Assistant) for any difficulty in the course outside the lab timings as well.

 

 

 Back

 

 

 


 

 

 

 

 

 

 

 

Instruction for vi editor:   Back

Use man vi  or pico command at SUN prompt  to go through the documentation related to vi editor or pico command

·        VI editor is commonly used editor for linux / unix environment. It will be useful in future. Initially you will find difficult to use. Utilize initial labs for learning this editor.

·        Also you can use the following link for vi editor tutorials

o       vitutor

  Back
 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

  Back
Python Instructions

·        At command prompt:  Load python interpreter by typing

>>> python

·        You are in python interpreting mode. You can type any python program and execute it

·        Alternatively, store your program in a file named as  file_name.py and load as follows:

>>>   python file_name.py

·        Your program starts executing and if it is free from errors, your results will be displayed.

  Back

 

 

 

 

 



 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 
 
Lab Schedule : Labs will be conducted in Computer Services Centre.

Back

 

T.A.s for CSL 101

 

 

 

 

 

 

 

S. No.

Name

contact No.

MailID

 

1

Soham Das

7827857566

88soham@gmail.com

2

Arvind Subramaniam R

9891278924

arvindsubbu88@gmail.com

3

Suvam Patra

9674251326

mcs103515@cse.iitd.ac.in

suvampatra2006@gmail.com

4

Moksh Upadhyay

7838425006

moksh1987@gmail.com

5

Sagar Bele

8882077129

sagarb.4488@gmail.com

6

Kanika Modi

9953614365

kanika.modi@gmail.com

7

Anupam

9868773730

anupam128@gmail.com

8

Manish Agarwal

9953622492

magwal5@gmail.com

9

Parul Pandey

9810524922

parulpandey27@gmail.com

   10

Manideepa

7428062726

manideepa.mukherjee@gmail.com

   11

Yamuna

9582017582

shukla.yamuna@gmail.com

12

ShashanK Sharma

9810361146

sharmashashank00@gmail.com

13

Eldhose Peter

8802545342

petereldhose@gmail.com

14

Davis Issac

9818954625

davis_isac@rediffmail.com

15

Aswin sashidharan

9818954550

techno.aswin@gmail.com

16

Mayur harne

 

mcs112570@cse.iied.ac.in

harnemayur@gmail.com

17

Ashish Khullar

9990641823

ashishkhullar89@gmail.com

 

 

 

 

 

 

 

01-08-2011 onwards  CSL 101 Lab

Monday

Tuesday

Wednesday

Thursday

Friday

11:00AM – 1:00PM

11:00AM – 1:00PM

11:00AM – 1:00PM

11:00AM – 1:00PM

11:00AM – 1:00PM

GP 4,9

GP 5, 10

GP1, 6

GP 2, 7

GP 3,8

 

 

 

 

 

Mayur Harne, Anupam, Shashank, Parul

Arvind,  Eldhose,  Davis, Manideepa

Parul,Moksh, Soham, Suvam

Davis, Sagar, Eldhose, Mayur

Arvind, Aswin,  Manideepa,  Kanika

 

 

 

 

 

 

Back

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Help sessions:

Back

 

08-09-2011 onwards  CSL 101 Help Session

Tuesday

Thursday

Saturday

8: 00PM – 9:00PM

8: 00PM – 9:00PM

8: 00PM – 9:00PM

All Groups

All Groups

All Groups

501, Bharti Building

501, Bharti Building

501, Bharti Building

Sagar, Shashank

Aswin, Anupam

Suvan, Soham

 

 

 

  • We have arranged help sessions for all the students facing difficulties in this course.
  • Since there are students with no computer background in this course, they are encouraged to attend all help sessions. 
  • The sessions will be held in Computer Service Centre  (Lab venue)
  • The schedule is given above

 

Back

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Back    List of Class committee members

 

1

2011CH10106

PRASHANT KUMAR

AP

G1

2

2011TT10947

RAGHAVENDER GOEL

AP

G2

3

2011TT10943

NOORPUNEET KAUR

AP

G3

4

2011CH70149

ASHUTOSH KUMAR YADAV

AP

G4

5

2011CH70182

SHUBAM GUPTA  -- Convener

AP

G5

6

2011CH10061

ABHIMANYU DUBEY

AP

G6

7

2011TT10922

HIMANSHU SATIJA

AP

G7

8

2011TT10973

SUSHIL KUMAR SINGH

AP

G8

9

2011TT10939

NEHA

AP

G9

10

2011CH70152

CHINMAY JOSHI

AP

G10

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

List of CSL101    Back

 

Date:                                                                                                                         

S.No.

Entry ID

Name

Slot

Group

1

2011CH10067

AMIT KUMAR

AP

G1

2

2011CH10070

ANKUSH JHAWAR

AP

G1

3

2011CH10076

BHARAT BAJAJ

AP

G1

4

2011CH10088

KUMAR  SARRAF

AP

G1

5

2011CH10094

MISHA KHURANA

AP

G1

6

2011CH10106

PRASHANT KUMAR

AP

G1

7

2011CH10109

RIDHI KAPOOR

AP

G1

8

2011CH10112

SALMAN KHAN

AP

G1

9

2011CH10115

SHAHID ARSHAD GAURI

AP

G1

10

2011CH10118

SONIYA MEHAR

AP

G1

11

2011CH10121

SWATI GUPTA

AP

G1

12

2011CH10124

VIKASH KUMAR

AP

G1

13

2011CH10127

VISHNU KUMAR MEENA

AP

G1

14

2011TT10906

AWADHESH YADAV

AP

G1

15

2011TT10911

DEVDUTT GOLIYA

AP

G1

16

2011TT10916

EKAGAR GUPTA

AP

G1

17

2011TT10931

KUSHANK BANSAL

AP

G1

18

2011TT10936

MS SUMAN MEENA

AP

G1

19

2011TT10941

NIKHIL ANAND

AP

G1

20

2011TT10946

PRERNA ARYA

AP

G1

21

2011TT10971

SURABHI JHA

AP

G1

22

2011TT10976

UTKARSH GARG

AP

G1

23

2011TT10991

MANGVUNG HAOKIP

AP

G1

24

2011CH70148

ARPIT JAIN

AP

G10

25

2011CH70150

BABU LAL KUMAWAT

AP

G10

26

2011CH70152

CHINMAY JOSHI

AP

G10

27

2011CH70154

DHARAMPAL SINGH MEEL

AP

G10

28

2011CH70156

DIVYA RANI

AP

G10

29

2011CH70168

MOUSUMI BORO

AP

G10

30

2011CH70170

PALASH KIRAR

AP

G10

31

2011CH70172

PARNIL SINGH

AP

G10

32

2011CH70174

PRACHI KUMARI

AP

G10

33

2011CH70176

PRITESH MEENA

AP

G10

34

2011CH70184

SOURAV MEENA

AP

G10

35

2011CH70188

VINITA KUMARI

AP

G10

36

2011CH70192

YASHI AGRAWAL

AP

G10

37

2011TT10900

ALOK SINGH

AP

G10

38

2011TT10910

D YASHASWINI

AP

G10

39

2011TT10915

DIVYAANSHU MAKKAR

AP

G10

40

2011TT10920

HARPREET BHATOA

AP

G10

41

2011TT10945

PRAMOD KUMAR SINGH

AP

G10

42

2011TT10950

RAMDAN CHARAN

AP

G10

43

2011TT10955

ROSHAN LAL MEENA

AP

G10

44

2011TT10960

SANCHIT GARG

AP

G10

45

2011TT10985

GUNJAN SEHRA

AP

G10

46

2011TT10990

VIJAY MEENA

AP

G10

47

2011CH10065

AKSHAT RAJ

AP

G2

48

2011CH10074

ASHVIN GOYAL

AP

G2

49

2011CH10083

GURKARAN SINGH

AP

G2

50

2011CH10086

ISHA CHARAK

AP

G2

51

2011CH10089

KUNAL VERMA

AP

G2

52

2011CH10095

MOHIBULLAH ANSARI

AP

G2

53

2011CH10098

NAMAN BHATNAGAR

AP

G2

54

2011CH10104

PRAERIT JAIN

AP

G2

55

2011CH10110

SAGAR ARORA

AP

G2

56

2011CH10113

SANJANA MANDRAI

AP

G2

57

2011CH10125

VIKRAM NAGMANI

AP

G2

58

2011CH10128

VIVEK CHANDRA YADAV

AP

G2

59

2011CH10131

NIRAJ KESHARI

AP

G2

60

2011TT10892

ABHIMANYU SINGH

AP

G2

61

2011TT10897

AKANCHHA JAISWAL

AP

G2

62

2011TT10902

ANEISH GOEL

AP

G2

63

2011TT10917

GURJINDER SINGH

AP

G2

64

2011TT10927

KIRANDEEP KAUR

AP

G2

65

2011TT10937

MUKESH KUMAR

AP

G2

66

2011TT10947

RAGHAVENDER GOEL

AP

G2

67

2011TT10957

RUSHIL KHURANA

AP

G2

68

2011TT10967

SHOBHIT JAISWAL

AP

G2

69

2011CH10066

AMAN SAURAV

AP

G3

70

2011CH10069

ANKIT AWASTHI

AP

G3

71

2011CH10072

ARCHIT JAIN

AP

G3

72

2011CH10075

AYUSH KATHURIA

AP

G3

73

2011CH10078

DEEPAK KUMAR YATI

AP

G3

74

2011CH10087

KESHAV MISHRA

AP

G3

75

2011CH10090

M RAJESH NAIK

AP

G3

76

2011CH10096

MOHIT YADAV

AP

G3

77

2011CH10105

PRAKHAR MISRA

AP

G3

78

2011CH10108

RAHUL KUMAR SINGH

AP

G3

79

2011CH10111

SAGAR

AP

G3

80

2011CH10123

VIKAS VERMA

AP

G3

81

2011CH10126

VISHAL BHATNAGAR

AP

G3

82

2011CH10129

VIVEK DHAKA

AP

G3

83

2011TT10898

AKANSH JAIN

AP

G3

84

2011TT10923

HIMANSHU GARG

AP

G3

85

2011TT10933

MANISHA MEENA

AP

G3

86

2011TT10938

NATASHA

AP

G3

87

2011TT10943

NOORPUNEET KAUR

AP

G3

88

2011TT10958

SAHIL SINGLA

AP

G3

89

2011TT10968

SOHIL RAJ

AP

G3

90

2011TT10988

SHELEHU D

AP

G3

91

2011CH70147

ANURIKA GOEL

AP

G4

92

2011CH70149

ASHUTOSH KUMAR YADAV

AP

G4

93

2011CH70151

BHARTI SINGHLA

AP

G4

94

2011CH70153

DAYAMA PARTH OMPRAKASH

AP

G4

95

2011CH70155

DINESH AHLAWAT

AP

G4

96

2011CH70167

MORE PRADEEP BABARAO

AP

G4

97

2011CH70169

NISHANT KUMAR

AP

G4

98

2011CH70171

PALLAVI GROVER

AP

G4

99

2011CH70173

PAWAN PATRE

AP

G4

100

2011CH70175

PRADUMAN ARORA

AP

G4

101

2011CH70183

SIDDHARTH DWIVEDI

AP

G4

102

2011CH70187

SURBHI SONI

AP

G4

103

2011CH70191

YASH PRAMOD DALMIA

AP

G4

104

2011TT10899

AKSHAY SANVALE

AP

G4

105

2011TT10909

CHIRAG JAIN

AP

G4

106

2011TT10914

DIKSHA JAIN

AP

G4

107

2011TT10919

GURU BHARDWAJ

AP

G4

108

2011TT10944

OM PRAKASH

AP

G4

109

2011TT10949

RAMAVATH ANUSHA

AP

G4

110

2011TT10954

ROHIT SAINI

AP

G4

111

2011TT10959

SAMEERA

AP

G4

112

2011TT10984

RAMLAKHAN KUMAR

AP

G4

113

2011TT10989

RAHUL RANA

AP

G4

114

2011CH70142

ABHINEET NAYYER

AP

G5

115

2011CH70144

AMAN JAIN

AP

G5

116

2011CH70146

ANKUR TENGURIA

AP

G5

117

2011CH70158

GAURAV KATHURIA

AP

G5

118

2011CH70160

KARTIK CHOUHAN

AP

G5

119

2011CH70162

KUNJI LAL MEENA

AP

G5

120

2011CH70164

MANISH KUMAR

AP

G5

121

2011CH70166

MOHIT MITTAL

AP

G5

122

2011CH70178

REHAN KHATRI

AP

G5

123

2011CH70180

SANKET JAIN

AP

G5

124

2011CH70182

SHUBAM GUPTA

AP

G5

125

2011CH70186

SUPRATIM DAS

AP

G5

126

2011CH70190

VIVEK BHASKAR

AP

G5

127

2011TT10895

ADIT JAIN

AP

G5

128

2011TT10905

AVIRAL SHARMA

AP

G5

129

2011TT10925

JITENDER

AP

G5

130

2011TT10930

KUNDAN

AP

G5

131

2011TT10935

MS PRIYANKA KUMARI MEENA

AP

G5

132

2011TT10940

NIDHI DAHIYA

AP

G5

133

2011TT10965

SHIVAM VERMA

AP

G5

134

2011TT10970

SUNIL VAISHNAV

AP

G5

135

2011TT10975

UTKARSH SINGH

AP

G5

136

2011TT10980

VENIKA AGGARWAL

AP

G5

137

2011CH10061

ABHIMANYU DUBEY

AP

G6

138

2011CH10064

AKASH BANSAL

AP

G6

139

2011CH10073

ARITRA NATH KUNDU

AP

G6

140

2011CH10079

DEVESH VIJ

AP

G6

141

2011CH10082

GAURAV DAKLIYA

AP

G6

142

2011CH10085

INGOLE GAURAV BALIRAM

AP

G6

143

2011CH10091

MALTI GUPTA

AP

G6

144

2011CH10097

MUNISH JINDAL

AP

G6

145

2011CH10100

NISHANT KUMAR

AP

G6

146

2011CH10103

PARVESH KADIYAN

AP

G6

147

2011CH10130

YOGESH RAGHUWANSHI

AP

G6

148

2011TT10891

AAKASH GOYAL

AP

G6

149

2011TT10896

AJIT KUMAR

AP

G6

150

2011TT10901

AMIT CHOUHAN

AP

G6

151

2011TT10921

HARSH RAJ

AP

G6

152

2011TT10926

JITENDER SINGH

AP

G6

153

2011TT10951

RAVI PRAKASH SHARMA

AP

G6

154

2011TT10956

RUPAK KUMAR

AP

G6

155

2011TT10961

SANYA OHRI

AP

G6

156

2011TT10966

SHIVIN GOYAL

AP

G6

157

2011TT10981

VIKAS GARG

AP

G6

158

2011TT10986

NITIN NEGI

AP

G6

159

2011CH10062

ABHISHEK GUPTA

AP

G7

160

2011CH10068

ANJALI

AP

G7

161

2011CH10071

APOORV JAIN

AP

G7

162

2011CH10077

CHARCHIT GAUR

AP

G7

163

2011CH10080

DHARAVATH MOHANLAL

AP

G7

164

2011CH10092

MANISH VARDHAN

AP

G7

165

2011CH10101

NISHANT KUMAR NIRALA

AP

G7

166

2011CH10107

PRATEEK PANGHAL

AP

G7

167

2011CH10116

SHRADHA KANWAT

AP

G7

168

2011CH10119

SUMITA

AP

G7

169

2011CH10122

VIKAS SUTHAR

AP

G7

170

2011TT10907

B MANOJ KUMAR

AP

G7

171

2011TT10912

DEVEN VIJ

AP

G7

172

2011TT10922

HIMANSHU SATIJA

AP

G7

173

2011TT10932

MANISH JANGID

AP

G7

174

2011TT10942

NITEN MUKESH

AP

G7

175

2011TT10952

RISHABH GUPTA

AP

G7

176

2011TT10962

SHALINI MATTA

AP

G7

177

2011TT10972

SUSHEEL KUMAR

AP

G7

178

2011TT10977

VENKATA SAI KIRAN VARANASI

AP

G7

179

2011TT10982

VIVEK NAUTIYAL

AP

G7

180

2011TT10987

PALDEEP DAS

AP

G7

181

2011CH10063

ADITYA GROVER

AP

G8

182

2011CH10081

GAGAN BANSAL

AP

G8

183

2011CH10084

HEMLATA MALAV

AP

G8

184

2011CH10093

MEHUL VARSHNEY

AP

G8

185

2011CH10099

NIKHIL AGGARWAL

AP

G8

186

2011CH10102

PARAG SINGHAL

AP

G8

187

2011CH10114

SARANG SUNIL NATH

AP

G8

188

2011CH10117

SHREY MALPANI

AP

G8

189

2011CH10120

SWARUPAM RAJ

AP

G8

190

2011TT10893

ABHISHEK SHARMA

AP

G8

191

2011TT10903

ANKIT CHOUDHARY

AP

G8

192

2011TT10908

CHANDAN KUMAR GUPTA

AP

G8

193

2011TT10913

DHARMENDRA

AP

G8

194

2011TT10918

GURPREET KAUR

AP

G8

195

2011TT10928

KOLHE DEVESH SUNIL

AP

G8

196

2011TT10948

RAHUL BENIWAL

AP

G8

197

2011TT10953

RISHAV SINHA

AP

G8

198

2011TT10963

SHANTANU VERMA

AP

G8

199

2011TT10973

SUSHIL KUMAR SINGH

AP

G8

200

2011TT10978

VARINDERJIT SINGH

AP

G8

201

2011TT10983

DEEPAK BEHAL

AP

G8

202

2011CH70141

AAYUSHI DIXIT

AP

G9

203

2011CH70143

AKSHAT SINGHAL

AP

G9

204

2011CH70145

ANIRUDH DUBEY

AP

G9

205

2011CH70157

FAHEEM SHEREEF

AP

G9

206

2011CH70159

JYOTI JAIN

AP

G9

207

2011CH70161

KRITAGYA KUMAR

AP

G9

208

2011CH70163

LIMKAR GAJANAN VISHNUDAS

AP

G9

209

2011CH70165

MAYANK MISHRA

AP

G9

210

2011CH70177

PRIYANKA GUPTA

AP

G9

211

2011CH70179

RINI KAPOOR

AP

G9

212

2011CH70181

SHIVANGI

AP

G9

213

2011CH70185

SUDHIR KUMAR

AP

G9

214

2011CH70189

VISHVENDRA SINGH DHAYAL

AP

G9

215

2011TT10894

ABHISHEK DHAKAR

AP

G9

216

2011TT10904

ASHOK KUMAR MEENA

AP

G9

217

2011TT10924

JAHNVI GOYAL

AP

G9

218

2011TT10929

KROTHAPALLI POORNIMA SAI CHOWDARY

AP

G9

219

2011TT10934

MANOJ SHARMA

AP

G9

220

2011TT10939

NEHA

AP

G9

221

2011TT10964

SHARAD BANSAL

AP

G9

222

2011TT10969

SUNDER DASS

AP

G9

223

2011TT10974

UTKARSH KUMAR JAUHARI

AP

G9

224

2011TT10979

VARUN

AP

G9

 

Back

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Back

 

 

PYTHON PROGRAMS for Stack and queue

 

______________________________________________________________

# Function for reading the elements of the list and terminate by 1000 (or some number which is not expected to be actual number

_____________________________________________________      

 

 

def push(s,x):

      tp = s[0]

      tp=tp+1

      s[0]=tp

      s[1]=s[1]+[x]

      return s

 

 

def pop(s):

      tp = s[0]

      if tp == -1:

            print('Empty stack\n')

      else:

            s[1]=s[1][0:tp] # Using slicing

            tp=tp-1

            s[0]=tp

      return s

 

 

def top(s):

      tp = s[0]

      if tp == -1:

             print 'Empty stack\n'

      else:

            x=s[1][tp]

            return x   

                 

 

def read_stack(s):

      x=input('Input the value and terminate by 1000\n')

      while x != 1000:

            push(s,x)

      return s

 

 

tp=-1

s=[tp,[]]

s=read_stack(s)

print 'Content of stack after pushing elements till 1000\n'

 

print ‘Top element of stack\n’, top(s)

 

s=pop(s)

print 'Content of stack after poping\n'

 

s=push(s)

print 'Content of stack after single push\n'

 

 

 

 

Back

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Back

 

Sorting techniques

_____________________________________________________

#     Function for reading the elements of the list and terminate by 1000 (or some number which is not expected to be actual number

_____________________________________________________      

 

def read(s):

      x=input('Input the value and terminate by 1000\n')

      while x != 1000:

            s=s+[x]

      return s

 

_____________________________________________________

#     Function for selection sort

_____________________________________________________      

 

# Find minimum of a list from ith index to jth index

def min(s, i, j):

      min=s[i]

      index = i

      for k in range (i+1,j):

            if min > s[k]:

                  min=s[k]

                  index = k

      return index     

           

# Section sort where minimum of unsorted list is found and exchange its #value with first element of unsorted list. Now unsorted list starts #from next element onwards till end.

 

def selection(s):

      i=0

      n=len(s)

      while i < n:

            x = min(s,i,n)

            #swap s[i] with s[index]

            t=s[i]; s[i] = s[x]; s[x]=t

            i=i+1

            print '\neach step of list\n', s

      return s

# Main program statements

s=[]

s=read(s)

print '\ncurrent list\n', s

s=selection(s)

print '\nsorted list\n', s

 

 

 

 

 

Back

 

Matrix Manipulation    

_____________________________________________

#     Function for reading the elements of the matrix 

__________________      

______________________________________________

 

n =  input('Input number of rows of a matrix\n')

m =  input('Input number of coulumns of a matrix \n')

a=[[0 for x in range (m)] for x in range (n)]

b=[[0 for x in range (m)] for x in range (n)]

 

def read(a,n,m):

      for i in range (n):

            for j in range (m):

                  a[i][j] = input('input elements of a matrix\n')

      return a

 

 

_____________________________________________

#     Function for Adding the elements of two matrices 

_____________________________________________________

 

def add(a,b,n,m):

      c=a

      for i in range (n):

            for j in range (m):

                  c[i][j] = a[i][j]+b[i][j]

      return c

 

 

read(a,n,m)

read(b,n,m)

c=add(a,b,n,m)

print ‘Matrix a is: \n', a

print ‘Matrix b is: \n', b

print 'Sum of two matrices is: \n',c

 

_____________________________________________

#     Function for Multiplying the elements of two matrices 

_____________________________________________________

 

def mult(a,b,n,m,p):

      for i in range (n):

            for j in range (p):

                  c[i][j] = 0

                  for k in range (m):

                        c[i][j] =

 

c[i][j] + a[i][k]*b[k][j]

      return c

 

print 'Input the dimensions of matrices\n'

 

n =  input('Input the value of n\n')

m =  input('Input the value of m \n')

p =  input('Input the value of p \n')

 

read(a,n,m)

read(b,m,p)

c= mult(a,b,n,m,p)

print ‘Matrix a is: \n', a

print ‘Matrix b is: \n', b

print 'Prod of two matrices is: \n', c

 

_____________________________________________

#     Function for transpose of square matrix 

_____________________________________________________

 

 

def trans(a,n):

      for i in range (n):

            for j in range (n):

                  b[i][j] = a[j][i]

      return b

 

n =  input('Input the dimension of square matrix\n')

read(a,n,n)

c=trans(a,n)

print ‘Original matrix is: \n', a

print ‘Transpose of a matrix is: \n', c

 

 

 

Back 

 

SIMPLE PYTHON PROGRAMS

 

________________________________________

#     Python Code for factorial

________________________________________

n= input('Enter the number \n');

i=0;

f=1;

while i<n:

      i=i+1;

      f = i*f;

print 'The factorial of %d is :  '%n, f;

 

 

 

 

____________________________________________

#     Python function for factorial

___________________________________________

 

def fact(n):

      i=0

      f=1

      while i <n :

            i= i+1

            f = i*f

 

      return f

 

 

print fact (5)

 

#n= input('Enter the number \n')

 

#print 'The factorial of %d is : %d ' %(n,fact(n))

 

 

 

____________________________________________­­­­­­­­­­­­­­­­­­­­­­­­

#     Python code without function  for finding maximum out of elements whose size is inputted by user

_____________________________________________

 

 

size=input('Enter the number \n');

max=0;

i=0

while i<size:

      i=i+1;

      num= input('Enter the number \n');

      if (num > max): max = num;

 

print   'maximum is :\n', max

 

 

______________________________________________

 

______________________________________________

#     Function for finding maximum out of n  elements where n is argument of the function and actual value is passed at     the time of call such as x=max(7); x=max(20) etc.

______________________________________________

 

def max(n):

      num= input('Enter the number %d times\n' %n);

      max=num;

      for i in range(1,n):

            num= input('Enter the number \n');

            if (num > max): max = num;

      return max;

 

n=input('Input the size of list\n');

print 'The maximun number is %d '  %max(n);

 

 

______________________________________________

#     Function for reversing the digits of a positive integer such as 23654  --> 45632        

______________________________________________

 

def rev(num):
     

      r=0
     

      while num>0:
           

            r=r*10 + num%10

            num= num/10

     

      return r

 

 

 

n= input('Enter the number \n')

print 'The Reversal of %d is : %d '  %(n, rev(n))

 

 

Back

 

LIST HANDLING    

__________________________________________________

#     Function for finding maximum out of 6 elements in a list L

______________________________________________

 

 

def max():

      L=[5,3,6,1,7,4]

      max=0

      for i in range(1,6):

            if (L[i] > max): max = L[i]

      return max

 

n = max()

print 'The maximum number is %d '  %n

 

 

______________________________________________

#     Function for finding maximum out of elements in a list where list L is argument of the function and actual list is passed at the time of call such as x=max([2,4,1,6,7]); x=max([2,10,43,56,22,89,11,23]. Here list can have as many elements as you want.

______________________________________________

def Max(L):

      max= 0;

      n=len(L)

      i=0

      while (i < n):

            if (L[i] > max):

                  max = L[i]

            i = i+1

      return max

 

m = Max([3,5,2,6,7,8,1])

print 'The maximun number is %d '  %m

 

 

______________________________________________

#     Function for adding the elements of the list.         

______________________________________________

def add(L):

      sum =0

      l= len(L)

      for i in range(0, l, 2):

            sum = sum +L[i]

      return sum

 

listsum = add([1, 2,3, 7, 9, 10,20])

print listsum

 

 

 

Back

 

STRING HANDLING    

______________________________________________

#     Code for splitting a sentence into words.

Display individual words, number of words and a

list of words.   

______________________________________________

 

x=raw_input("Enter the sentence :\n")

lx = len(x)

w=''

lis=[]

c=0

 

print '\nThe words of the senetnce "%s" are:\n'%x

 

for i in range (lx):

      if (x[i] != ' ' and x[i] != '.'):

            w=w + x[i]

      else:

            lis = lis +[w]

            print w

            c=c+1

            w=''

           

print '\nNumber of words: ', c

print '\nList of words in a sentence is: ', lis

 

 

______________________________________________

#     Code for splitting a paragraph into sentences and display list of all the words in the paragraph, each sentence and total count of sentence. Make sure that each word is separated by single space and sentence is terminated by ‘.’. New sentence should start with space after .

______________________________________________

 

 

S = raw_input("Enter a paragraph with each

 

sentence terminated by . :\n")

S = S.split()

 

count = 0

lx = len(S)

print '\nList of the words in the

 

paragraph:\n', S

 

print '\nSentences in paragapgh are:\n'

i=0

w=[]

while (i < lx):

     

      b = S[i].count('.')

      if (b == 0):

            w=w+[S[i]]

      else:

            w=w+[S[i]]

            sent = w

            print " ".join(sent)

            w=[]

            count=count+1

      i = i + 1

print '\nNumber of sentences are = ', count

 

Back

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Back

Assignment 1: (Total marks  30 )

Due Date : 30 August, 2011

August 21, 2011

 

1.     Write a code in Python using function for following mathmetical operations with two input operands:

·        AddTwo(n , m) which returns n + m

·        MulTwo(n , m) which returns n * m

·        DivTwo(n , m) which returns n / m where n and m are operands.

 

2.     Write a code in Python using function eg. Prime(n) which displays a user given number is prime or not.

3.     Write a code in Python to print table for 2 to 10.

4.     Write a code in Python using function to _nd the factorial of a given number without recursion.

5.     Write a code in Python using function to display the Fibonacci series without recursion.

6.     Write a code in Python to sum the following series using function, where number of terms is given by user:

Sum = 1 + 1*2 + 2*3 + 3* 4 + ...... user defined terms.

Back

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Back

Assignment 2: (Total Marks: 50)

Please note:

Submission Date: 21st   Sept (Mail to your TA)

Demo Date:  Latest by 28th  Sept (Get assignments evaluated in the lab class as soon as you submit)

 

You have to implement the following operations for Binary number system in Python. Write menu driven Python program and call the following functions appropriately. 

 

      1. Input a decimal number (such as 6453254) and convert it into its equivalent binary representation and display both decimal and corresponding binary representation.                                (15)
      2. Adder: Add two binary numbers (input them as binary digits). Display two inputs and result in decimal and corresponding binary representations.                                                         (15)
      3. Find 2’s complement representation of binary number and display corresponding decimal number, number itself and its 2’s complement.                                                                (10)
      4. Write display function separately (for converting binary to Decimal number) and use it appropriately in above functions. Do not bother about sign bit.                                                (10)

 

When you execute your program, the following menu should be displayed.

 

MENU

 

Conversion (from Decimal to binary)     -           1

Addition                                               -           2

2’s compliment                         -           3

Conversion (Binary to Decimal)            -           4

Exit                                                      -           5

 

Back

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Back

Assignment 3: Text Processing (Total marks 30 )

Please note:

Submission Date: 2nd Nov. 2011 (Mail to your TA)

Demo Date:  Latest by 8th  Nov. 2011 (Get assignments evaluated in the lab class as soon as you submit)

 

 

There are 3 assignments in this document. Fortunately, you are not required to do all the 3 assignments. Your assignment will be chosen as follows: 

_______________________________________________________________

Let the last 3 digits of your entry number represent number N. Let N%7 be m.

·        If m is 0 or 1, do assignment 3A.

·        If m is 2 or 3 then do assignment 3B.

·        If m is 4, 5 or 6 then do assignment 3C.

________________________________________________________________

 

Write separate functions for each sub problem. You are allowed to use only those built-in  functions of Python which we have covered in the lecture class. At the top of your program show the calculation of your assignment choice using with your entry number.

Assignment 3A

You will be given a text passage in the form of a file named “abc.txt”. You may assume that the text will not contain any words like won’t, isn’t, hasn’t, Anita’s, that’s etc.

Write a program in python which reads the text and prints

1.      Number of capital letters in the text.                                                                  (10)

2.      Number of words with 5 letters or more, also print those words.                        (10)

3.      The text message removing the words in upper case.                                         (10)

Sample Input:

The 16 Data types you have seen so far are all COMPLETE in the sense that We have completely specified all the 1200 WAYS to write the data as ADT.

Sample Output:

Number of capital letters: 18

Count of words with 5 or more letters: 6

types COMPLETE sense completely specified write

The 16 Data types you have seen so far are all, in the sense that We have completely specified all the 1200 to write the data as.

Assignment 3B

You will be given a text passage in the form of a file named “abc.txt”.  In this text, there will not be any words like won’t, isn’t, hasn’t, Anita’s, that’s etc. Also, it will not have any digits.

Write a program in python which reads the text and prints

1.      The number of all the words in the text.                                                 (10)

2.      Frequency of occurrence of various words which occur more than once. Ignore the words   “of, is, a, an, the, are” while counting. Counting should not be case sensitive (for example both Type and type represent the same word).             (20)

 

Note: Do this assignment without using the Dictionary data type.

 

Sample Input:

The Salvo is a very useful feature string. Salvo can reverse the order of operations. Salvo AA is like salvo BB but not every salvo looks similar. The order can change in output if the input order looks different. It is more like a list but more useful than a string.

Sample Output:

Number of words: 51

Frequency of words:

Salvo:  5

useful:  2

looks: 2

string: 2

can: 2

more: 2

but: 2

like: 2

order: 3

Assignment 3C

You will be given a text passage in the form of a file named “abc.txt”.  In this text, there will not be any words like won’t, isn’t, hasn’t, Anita’s, that’s etc. The text contains only alphabets, digits, full stop and question mark (and no other special characters).

Write a program in python which 

1.      prints the number of sentences in the text.                                                          (10)

2.      prints the text by reversing the order of words in each sentence (one sentence per line). Capitalize the first letter of each new sentence after reversal (Remember to convert the first letter of the sentence in the original text into lower case). If it is a number, leave it as it is.                                                                             (20)

Sample Input:

It is a warm day. Dogs are running. Sit down. Drink CLEAR water. Take bus 764. Do you like it?

Anita said she was going back.

Sample Output:

No of sentences:  7

Day warm a is it.

Running are dogs.

Down sit.

Water CLEAR drink.

764 bus take.

It like you do?

Back going was she said anita.

Back