Advertisement
Guest User

Untitled

a guest
Sep 25th, 2017
327
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 15.75 KB | None | 0 0
  1. Sl No Topic Program Assignment
  2.  
  3. 1 Python program basic Write a program to add , Subtract, Multiply, and divide 2 numbers
  4.  
  5. 2 Basic Operators Write a program to find the biggest of 3 numbers ( Use If Condition )
  6.  
  7. 3 Basic operators Write a program to find given number is odd or Even
  8.  
  9. 4 Basic operators Write a program to find the number is Prime or not.
  10.  
  11. 5 Command line Arguments Write a program to receive 5 command line arguments and print each argument separately. Example : >> python test.py arg1 arg2 arg3 arg4 arg5 a) From the above statement your program should receive arguments and print them each of them. b) Find the biggest of three numbers, where three numbers are passed as command line arguments.
  12.  
  13. 6 Basic String operations Write a program to read string and print each character separately. a) Slice the string using slice operator [:] slice the portion the strings to create a sub strings. b) Repeat the string 100 times using repeat operator * c) Read strig 2 and concatenate with other string using + operator.
  14.  
  15. 7 Basic List Operations Create a list with at least 10 elements in it print all elements perform slicing perform repetition with * operator Perform concatenation wiht other list.
  16.  
  17. 8 Basic of Tuple Repeat program 7 with Tuple( Take example from Tutorial )
  18.  
  19. 9 Python Numbers Write program to Add , subtract, multiply, divide 2 complex numbers.
  20.  
  21. 10 Assignment Operator Using assignment operators, perform following operations Addition, Substation, Multiplication, Division, Modulus, Exponent and Floor division operations
  22.  
  23. 11 Bitwise Operator Read 2 numbers to variable a and b and perform all bitwise operations on that numbers.
  24.  
  25. 12 Comparison operator Read 10 numbers from user and find the average of all. a) Use comparison operator to check how many numbers are less than average and print them b) Check how many numbers are more than average. c) How many are equal to average.
  26.  
  27. 13 Decision making (IF .. Else structure) Write a program to find the biggest of 4 numbers. a) Read 4 numbers from user using Input statement. b) extend the above program to find the biggest of 5 numbers. ( PS : Use IF and IF & Else , If and ELIf, and Nested IF )
  28.  
  29. 14 Python List functions and Methods Write a program to create two list A and B such that List A contains Employee Id, List B contains Employee name ( minimum 10 entries in each list ) and perform following operations a) Print all names on to screen b) Read the index from the user and print the corresponding name from both list. c) Print the names from 4th position to 9th position d) Print all names from 3rd position till end of the list e) Repeat list elements by specified number of times ( N- times, where N is entered by user) f) Concatenate two lists and print the output. g) Print element of list A and B side by side.( i.e. List-A First element , List-B First element )
  30.  
  31. 15 Python List functions and Methods Create a list of 5 names and check given name exist in the List. a) Use membership operator ( IN ) to check the presence of an element. b) Perform above task without using membership operator. c) Print the elements of the list in reverse direction.
  32.  
  33. 16 Python Numbers Write program to perform following: i) Check whether given number is prime or not. ii) Generate all the prime numbers between 1 to N where N is given number.
  34.  
  35. 17 Decision making (IF .. Else structure) Write program to find the biggest and Smallest of N numbers. PS: Use the functions to find biggest and smallest numbers.
  36.  
  37.  
  38. 18 Looping structures Using loop structures print numbers from 1 to 100. and using the same loop print numbers from 100 to 1.( reverse printing) a) By using For loop b) By using while loop c) Let mystring ="Hello world" print each character of mystring in to separate line using appropriate loop structure.
  39.  
  40.  
  41. 19 Looping structures Using loop structures print even numbers between 1 to 100. a) By using For loop , use continue/ break/ pass statement to skip odd numbers. i) break the loop if the value is 50 ii) Use continue for the values 10,20,30,40,50 b) By using while loop, use continue/ break/ pass statement to skip odd numbers. i) break the loop if the value is 90 ii) Use continue for the values 60,70,80,90
  42.  
  43.  
  44. 20 Looping structures Write a program to generate Fibonacci series of numbers. Starting numbers are 0 and 1, new number in the series is generated by adding previous two numbers in the series. Example : 0, 1, 1, 2, 3, 5, 8,13,21,..... a) Number of elements printed in the series should be N numbers, Where N is any +ve integer. b) Generate the series until the element in the series is less than Max number.
  45.  
  46.  
  47. ====================================================================================================================================
  48.  
  49. 21 Math and Random Modules Using the built in functions on Numbers perform following operations
  50. a) Round of the given floating point number example : n=0.543 then round it next decimal number , i.e n=1.0 Use round() function
  51. b) Find out the square root of a given number. ( use sqrt(x) function)
  52. c) Generate random number between 0, and 1 ( use random() function)
  53. d) Generate random number between 10 and 500. ( use uniform() function)
  54. e) Explore all Math and Random module functions on a given number/ List. ( Refer to tutorial for Math & Random functions list)
  55.  
  56.  
  57.  
  58.  
  59. 22 Math- Trigonometric functions Read the value x and y from the user and apply all trigonometric functions on these numbers.
  60. Note : Refer the tutorial Trigonometric operation table.
  61.  
  62.  
  63. 23 Math – math.pi application Find the area of Circle given that radius of a circle. ( Use pi value from Math module)
  64.  
  65.  
  66. 24 Strings Special Characters: Write program to explore all Escape characters specified in Tutorial ( Under String chapter)
  67.  
  68.  
  69.  
  70. 25 Strings Write a program to print the different data types( Numbers, strings characters) using the Format symbols
  71. ( Refer to different format symbols specified in Tutorial )
  72.  
  73.  
  74.  
  75. 26 Strings Receive the encoded string from your friend and decode it to check the original message.
  76. PS: You will receive Encoded string and the Algorithm used for encoding.
  77.  
  78.  
  79.  
  80. 27 Strings Write a program to check given string is Palindrome or not.
  81. That is reverse the given string and check whether it is same as original string,
  82. if so then it is palindrome. Example : String = "malayalam" reverse string = "malayalam" hence given string is palindrome.
  83. Use built functions to check given string is palindrome or not.
  84.  
  85.  
  86.  
  87. 28 Strings Write a program to check how many ovals present in the given string.
  88. That is, count the number of " a e i o u" in the given string and print the numbers against each oval.
  89. Example :- "This is Python" Number of total ovals = 3 i = 2 o =1
  90.  
  91.  
  92. 29 Strings Apply all built in functions on Strings in your program.
  93. Note there are 40 string functions. Use Tutorial for the help.
  94. Note: Each program should have 5 string built in functions ( so write 8 programs to cover all string functions)
  95.  
  96.  
  97. 30 Strings Write a program to Sort given N numbers
  98. ( Use only loop structures and Conditions to sort the elements. Use Bubble sort / Selection sort technique to sort the elements of List) Note : don't use built in functions to sort.
  99.  
  100.  
  101.  
  102. 31 Strings Write a program to search an element in the list.
  103. i.e. Perform the binary search on the sorted list having integers as elements.
  104. If the search is successful print "Success" else print "un successful search".
  105.  
  106.  
  107.  
  108. 32 Strings Write a program to perform following operations on List.
  109. Create 3 lists List1,List2 and List3 a.
  110. Find the length of each list and print it b.
  111. Find the maximum and minimum element of each list c.
  112. Compare each list and determine which list is biggest & which list is smallest.
  113. d. Delete first and last element of each list and print list contents.
  114.  
  115.  
  116. 33 Strings Create a list with 7 elements and perform following operations.
  117. Let List=[10,20,30,40,50,60,70]
  118. a) Append an object 80 to the List
  119. b) insert object 100 at 4th position
  120. c) Sort the list and print all elements
  121. d) Sort the elements of the list in descending order.
  122. e) delete last three elements using pop operation
  123.  
  124.  
  125. 34 Strings Create 3 Lists ( list1,list2,list3) with numbers and perform following operations
  126. a) Create Maxlist by taking 2 maximum elements from each list.
  127. b) Find average value from all the elements of Maxlist.
  128. c) Create a MinlIst by taking 2 minimum elements from each list
  129. d) Find the average value from all the elements of Minlist
  130.  
  131.  
  132. 35 Strings Create Tuple as specified below
  133. a) Create a Tuple tup1 with days in a week & print the tuple elements
  134. b) Create a Tuple tup2 with months in a year and concatenate it with tup1
  135. c) Create 3 tuples( tup1,tup2,tup3) with numbers and determine which is greater.
  136. d) Try to delete an individual element in tup1 and try deleting complete Tuple -tup1 Notice the error type you get.
  137. e) Insert new element in to tuple by typecasting it to List
  138.  
  139.  
  140.  
  141.  
  142. 36 Strings Create two tuples tup1 & tup2 and apply all built in functions on tuples.
  143. ( Refer Tutorial for the Built in functions list)
  144.  
  145.  
  146.  
  147. 37 Dictionary and Date & Time Create 3 dictionaries(dict1,dict2,dict3) with 3 elements each. Perform following operations
  148. a) Compare dictionaries to determine the biggest.
  149. b) Add new elements in to the dictionaries dict1, dict2
  150. c) print the length of dict1,dict2,dict3.
  151. d) Convert dict1, dict2, and dict3 dictionaries as string and concatenate all strings together.
  152.  
  153.  
  154. 38 Dictionary and Date & Time Create 2 dictionaries as follows
  155. dict1 ={'Name':'Ramakrishna','Age':25} dict2={'EmpId':1234,'Salary':5000}
  156. Perform following operations
  157. a) Create single dictionary by merging dict1 and dict2
  158. b) Update the salary to 10%
  159. c) Update the age to 26
  160. d) Insert the new element with key "grade" and assign value as "B1"
  161. e) Extract and print all values and keys separately.
  162. f) delete the element with key 'Age' and print dictionary elements.
  163.  
  164.  
  165. 39 Dictionary and Date & Time Using Time and Calendar module ,Print current date and time. Print current month calendar.
  166.  
  167.  
  168. 40 Dictionary and Date & Time Using time module perform following operations.
  169. a) Print current time for every 5 seconds up to 1 minute time interval.
  170. b) Write a program to find out how much CPU time is taken for the execution of above(32.a) program.
  171.  
  172.  
  173. 41 Dictionary and Date & Time Using calendar module perform following operations.
  174. a)print the 2016 calendar with space between months as 10 character.
  175. b) How many leap days between the years 1980 to 2025.
  176. c) Check given year is leap year or not.
  177. d) print calendar of any specified month of the year 2016.
  178.  
  179.  
  180. 42 Functions Write a program to generate a Fibonacci series using a function called fib(n),
  181. a) where N is user specified argument specifies number of elements in the series.
  182.  
  183.  
  184. 43 Functions Write a program to search given element from the list.
  185. Use your own function to search an element from list.
  186. Note: Function should receive variable length arguments and search each of these arguments present in the list.
  187.  
  188.  
  189. 44 Functions Write a program with lambda function to perform following.
  190. a) Perform all the operations of basic calculator ( add, sub, multiply, divide, modulus, floor division )
  191.  
  192.  
  193.  
  194. 45 Functions Write a program to check given string is Palindrome or not.
  195. ( Use function Concepts and Required keyword, Default parameter concepts)
  196. That is reverse the given string and check whether it is same as original string, if so then it is palindrome.
  197. Example : String = "Malayalam" reverse string = "Malayalam" hence given string is palindrome.
  198.  
  199.  
  200.  
  201. 46 Functions Write a function to find the biggest of 4 numbers.
  202. a) All numbers are passed as arguments separately ( Required argument)
  203. b) use default values for arguments ( Default arguments)
  204.  
  205.  
  206. 47 Functions Write function to extend the tuple with elements of list. Pass list and Tuple as parameter to the function.
  207.  
  208.  
  209. 48 Functions Create a Calculator with the following functions.
  210. a) Addition/subtraction/multiplication and division of two numbers
  211. ( Note: Create separate function for each operation )
  212. b) Find square root of a given number.( Use keyword arguments in your function)
  213. c) Create a list of sub strings from a given string, such that sub strings are created with given character.
  214. That is, string = "Pack: My: Box: With: Good: Food" Create sub strings with the delimiter character ":"
  215. such that the following sub strings are created. substrlist=[Pack, My, Box, With, Good, Food]
  216. Note : Function should take at least 2 parameters ( Main string and delimiter character) return value from function will be
  217. list of substring.
  218.  
  219.  
  220. 49 File I/O Operations Write a program to perform following file operations
  221. a) Open the file in read mode and read all its contents on to STDOUT.
  222. b) Open the file in write mode and enter 5 new lines of strings in to the new file.
  223. c) Open file in Append mode and add 5 lines of text into it.
  224.  
  225.  
  226. 50 File I/O Operations Write a program to open the existing file in read mode and perform following tasks,
  227. a) Rad 10 character at a time and then print its current position of file object.
  228. Repeat this operation till the EOF.
  229. b) Reset the file pointer after reading 100 Character from file ( Use Seek function to reset)
  230. c) Open the file in read mode and start printing the contents from 5th line onwards.
  231.  
  232.  
  233. 51 File I/O Operations In a given directory search all text files for the pattern "Treasure".
  234. a) Find how many text file has the pattern.
  235. b) Count how many times pattern repeats in each file
  236. Note : Create at least 4 text file in a directory and keep the pattern in at least 2 files.
  237. Repeat the pattern in the file many times.
  238.  
  239.  
  240. 52 File I/O Operations Open existing text file and reverse its contents.
  241. i.e a) print the last line as first line and first line as last line ( Reverse the lines of the file )
  242. b) print characters of file from last character of file till the first character of the file.(Reverse entire contents of file )
  243.  
  244.  
  245. 53 File I/O Operations Open the file is read & write mode and apply following functions
  246. a) All 13 functions mentioned in Tutorial File object table.
  247.  
  248.  
  249. 54 Exception Handling Write a program to handle the following exceptions in you program.
  250. a) KeyboardInterrupt, b) NameError c) ArithmeticError Note : make use of Try, except, else: statements.
  251.  
  252.  
  253.  
  254. 55 Exception Handling Write a program for converting weight from Pound to Kilo grams.
  255. a) Use assertion for the negative weight. b) Use assertion to weight more than 100 KG
  256.  
  257.  
  258.  
  259. 56 Exception Handling Write a program to handle following exceptions using Try block.
  260. a) IO Error while you try writing contents into the file that is opened in read mode only. b) ValueError
  261.  
  262.  
  263.  
  264. 57 Exception Handling From the Standard Exception Table of Tutorials:
  265. Try implementing all (25 ) exceptions in you program. Note: Some exceptions might not work on your system.
  266.  
  267.  
  268.  
  269. 58 Modules & Packages Create file called "calc.py" which has following functions
  270. i) functions to add 2 numbers
  271. ii) function to find diff of 2 numbers
  272. iii) function to multiply 2 numbers
  273. iv) all maths operations ( Sqrt, div, floor div, modulus, primnumber)
  274. v) Fibonacci series
  275. a) Write a new program in file "maths.py" such that you import functions of file "calc.py" to your new program
  276. b) Use From <module> import <function> statement to import only few function from calc module.
  277.  
  278.  
  279.  
  280. 59 Modules & Packages Create file called "stringop.py" which has following functions
  281. i) functions to sort numbers( Use loops for sorting, do not use built in function)
  282. ii) function to search given element through binary search method. ( Refer to net for the Binary search algorithm)
  283. iii) function to reverse the given string Write new program in file strpackage.py such that you import functions of file "stringop.py" to your new program
  284.  
  285.  
  286.  
  287. 60 Modules & Packages Create a package of all programs you have done in previous class.
  288. a. All programs related to strings - Stringpackage
  289. b. All programs related to Lists -ListPackage
  290. c. All programs related to tuple - TuplePackage
  291. d. All programs related to Dictionary -DictionaryPackage
  292. e. All programs related to functions - FunctionPackage
  293. f. All programs related to Files -- FilePackage
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement