question archive Python Programming C
Subject:Computer SciencePrice:0 Bought3
Python Programming C.S. DIGITAL ASSIGNMENT-4 QUESTIONs
Q1. Define a function to print an element ,a tuple and a dictionary of variable arguments using * and **.
Q2. Define a function to print multiple elements by passing only a single actual/informal argument containing all the elements.
Q3. Write a function to display sum of odd and even nos upto a given no. using recursion.
Q4. Write a function to display whether the inputted no. is a prime no. or not.
Q5.Define a function using recursion to print factorial of a given no.
Q6.Define a function to copy the data of a file into another file called “welcome.txt”.
Q7. Create a file consisting of 10 lines of text and print its 5th line, 6th line, total no. of lines, words and spaces. Also print the words which start with alphabet “s or e” using regular expressions.
Q8.Write a program to insert a text in the 3rd line of a file containing 7 lines.
Q9. Ram is planning to give chocolates to two of his brother. He comes to a shop that has ‘n’ chocolates of type 1 and ‘m’ chocolates of type 2, and Ram wants to buy largest but equal no. of both. Write a program to determine the no. using recursive function.
Q10.Write a program check if a file is closed or not and also print the name and access mode of the file.