Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

Basic python programming, Exams of Computer Programming

Python programs related to assignments

Typology: Exams

2018/2019

Uploaded on 01/01/2019

thilak85
thilak85 🇮🇳

1 document

Partial preview of the text

Download Basic python programming and more Exams Computer Programming in PDF only on Docsity!

Instructions:

  1. Write the complete assignments and submit on or before 05.10.2018.
  2. Don’t send any softcopy. If you submit in softcopy you will awarded with 0 marks.
  3. Don’t copy any content from others.
  4. No more acceptances of the assignments after the deadline you will be awarded with 0 marks.

Assignments 5 Dictionaries:

  1. Write a short note on Dictionary Data Structure? Explain any 5 methods available in Dictionaries with examples?
  2. Write a program that creates a dictionary of cubes of odd numbers in a given range 1-20?

3. Write a Python program to count of the letters from the string and create a dictionary from a string.

  1. Write a program that has a dictionary of your friend’s name (as keys) and their birthdays. Print the items in the dictionary in a sorted order. Prompt the user to enter a name and check if it is present in the dictionary. If the name does not exist, then ask the user to enter DOB. Add the details in the dictionary?

5. Write a program that prints the maximum and minimum value in a dictionary?

Assignment 6 Strings:

  1. With the help of example, explain how we can create strings? Write any five important methods available in strings each with example?
  2. Write the differences between mutable and immutable?
  3. If str= “Welcome to the RGUKT IIIT Basar Campus and Python Programming” answer the following questions: 3.a. Write a program to print tenth character of the above string 3.b.Write a program to print reverse string 3.c. Write a program to print words available in the above string? 3.d.Write a program to print all capital letters available in above string? 3.e. Write a program to print length of above string? 3.f. Write a program to convert above string into all capital letters? 3.g.Write a program to print the index of given word of “IIIT”?

4. Write a program to count the occurrences of each word in given sentence?

5. Write a Program to find the number of Vowels, Consonants, Digits and White space in a String?

6. Write a program to take list of strings and print the longest string?

Assignment 7 Functions:

  1. What is a function? How can u create a functions explain with example? What are the advantages of functions? Explain the followings words: parameters, arguments, return, and function call?
  2. List out the types of arguments and explain each type with an example?
  3. Write a program that finds the greatest of three given numbers using functions?
  4. What is user defined functions and pre defined functions? Explain with one example program?
  5. Write a program using function that calculates the hypotenuse of a right angled triangle?
  6. Write a program to calculate the area, volume of a cuboids’ using default arguments?

7. Write a program to calculate amount. Suppose the customer is a senior citizen is being offered 12 percent

ROI. For all other customers the ROI is 13 percent. (amount = P+SI)

Assignment 8

Recursion and Functional Programming:

  1. Define recursion? Explain with the example?
  2. Write a program to calculate the GCD using the recursion?
  3. Write a program to find the Fibonacci series using recursion?
  4. Explain anonymous function? Write a short note on filter(), map() functions with example?

5. Write a program to find common elements of two lists by using lambda function?

6. Write a program to print length of each word of the given string by using lambda function?

Assignment 9 Modules:

  1. What is a module? List out any four modules available in python?
  2. Write a short note on OS and math module with four functions in each module?

3. Write a program which randomly picks an integer from 1 to 100. Your program should prompt the user for

guesses – if the user guesses incorrectly, it should print whether the guess is too high or too low. If the

user guesses correctly, the program should print how many guesses the user took to guess the right

answer. You can assume that the user will enter valid input.