100% Guaranteed Results


Python – Solved
$ 29.99

Description

5/5 – (1 vote)

Python Assignments
Module – 2
• Write a Python program to check if a number is positive, negative or zero.
• Write a Python program to get the Factorial number of given number.
• Write a Python program to get the Fibonacci series of given range.
• How memory is managed in Python?
• What is the purpose continue statement in python?
• Write python program that swap two number with temp variable and without temp variable.
• Write a Python program to find whether a given number is even or odd, print out an appropriate message to the user.
• Write a Python program to test whether a passed letter is a vowel or not.
• Write a Python program to sum of three given integers. However, if two values are equal sum will be zero.
• Write a Python program that will return true if the two given integer values are equal or their sum or difference is 5.
• Write a python program to sum of the first n positive integers.
• Write a Python program to calculate the length of a string.
• Write a Python program to count the number of characters (character frequency) in a string
• What are negative indexes and why are they used?
• Write a Python program to count occurrences of a substring in a string.
• Write a Python program to count the occurrences of each word in a given sentence
• Write a Python program to get a single string from two given strings, separated by a space and swap the first two characters of each string.
• Write a Python program to add ‘ing’ at the end of a given string (length should be at least 3). If the given string already ends with ‘ing’ then add ‘ly’ instead if the string length of the given string is less than 3, leave it unchanged.
• Write a Python program to find the first appearance of the substring ‘not’ and ‘poor’ from a given string, if ‘not’ follows the ‘poor’, replace the whole ‘not’…’poor’ substring with ‘good’. Return the resulting string.


Write a Python function that takes a list of words and returns the length of the longest one.
• Write a Python function to reverses a string if its length is a multiple of 4.
• Write a Python program to get a string made of the first 2 and the last 2 chars from a given a string. If the string length is less than 2, return instead of the empty string.
o Sample String: w3resource’ o Expected Result: ‘w3ce’ o Sample String: ‘w3’ o Expected Result: ‘w3w3’ o Sample String: ‘ w’ o Expected Result: Empty String

Write a Python function to insert a string in the middle of a string.
Module – 3
• What is List? How will you reverse a list?
• How will you remove last object from a list?
• Suppose list1 is [2, 33, 222, 14, and 25], what is list1 [-1]?
• Differentiate between append () and extend () methods?
• Write a Python function to get the largest number, smallest num and sum of all from a list.
• How will you compare two lists?
• Write a Python program to count the number of strings where the string length is 2 or more and the first and last character are same from a given list of strings.
• Write a Python program to remove duplicates from a list.
• Write a Python program to check a list is empty or not.
• Write a Python function that takes two lists and returns true if they have at least one common member.
• Write a Python program to generate and print a list of first and last 5 elements where the values are square of numbers between 1 and 30.
• Write a Python function that takes a list and returns a new list with unique elements of the first list.
• Write a Python program to convert a list of characters into a string.
• Write a Python program to select an item randomly from a list.
• Write a Python program to find the second smallest number in a list.


Write a Python program to get unique values from a list
• Write a Python program to check whether a list contains a sub list
• Write a Python program to split a list into different variables.
• What is tuple? Difference between list and tuple.
• Write a Python program to create a tuple with different data types.
• Write a Python program to create a tuple with numbers.
• Write a Python program to convert a tuple to a string.
• Write a Python program to check whether an element exists within a tuple.
• Write a Python program to find the length of a tuple.
• Write a Python program to convert a list to a tuple.
• Write a Python program to reverse a tuple.
• Write a Python program to replace last value of tuples in a list.
• Write a Python program to find the repeated items of a tuple.
• Write a Python program to remove an empty tuple(s) from a list of tuples.
• Write a Python program to unzip a list of tuples into individual lists.
• Write a Python program to convert a list of tuples into a dictionary.
• How will you create a dictionary using tuples in python?
• Write a Python script to sort (ascending and descending) a dictionary by value.
• Write a Python script to concatenate following dictionaries to create a new one.
• Write a Python script to check if a given key already exists in a dictionary.
• How Do You Traverse Through A Dictionary Object In Python?
• How Do You Check The Presence Of A Key In A Dictionary?
• Write a Python script to print a dictionary where the keys are numbers between 1 and 15.
• Write a Python program to check multiple keys exists in a dictionary
• Write a Python script to merge two Python dictionaries
• Write a Python program to map two lists into a dictionary
• Write a Python program to combine two dictionary adding values for common keys.
o d1 = {‘a’: 100, ‘b’: 200, ‘c’:300} o d2 = {‘a’: 300, ‘b’: 200,’d’:400}
• Sample output: Counter ({‘a’: 400, ‘b’: 400,’d’: 400, ‘c’: 300}).
• Write a Python program to print all unique values in a dictionary.
• Why Do You Use the Zip () Method in Python?


Write a Python program to create and display all combinations of letters, selecting each letter from a different key in a dictionary.
o Sample data: {‘1’: [‘a’,’b’], ‘2’: [‘c’,’d’]} o Expected Output: o ac ad bc bd
• Write a Python program to find the highest 3 values in a dictionary
• Write a Python program to combine values in python list of dictionaries.
Sample data: [{‘item’: ‘item1’, ‘amount’: 400}, {‘item’: ‘item2’, ‘amount’:
300}, o {‘item’: ‘item1’, ‘amount’: 750}]
o Expected Output: Counter ({‘item1’: 1150, ‘item2’: 300})
• Write a Python program to create a dictionary from a string.
o Note: Track the count of the letters from the string. Sample string:
‘w3resource’
o Expected output: {‘3’: 1,’s’: 1, ‘r’: 2, ‘u’: 1, ‘w’: 1, ‘c’: 1, ‘e’: 2, ‘o’: 1}
• Write a Python function to calculate the factorial of a number (a nonnegative integer)
• Write a Python function to check whether a number is in a given range
• Write a Python function to check whether a number is perfect or not.
• Write a Python function that checks whether a passed string is palindrome or not
• How do you perform pattern matching in Python? Explain
• What is lambda function in python? What we call a function which is incomplete version of a function?
• How Many Basic Types Of Functions Are Available In Python?
• How can you pick a random item from a list or tuple?
• How can you pick a random item from a range?
• How can you get a random number in python?
• How will you set the starting value in generating random numbers?
• How will you randomizes the items of a list in place?
• Write a Python program to read a random line from a file.
• Write a Python program to convert degree to radian
• Write a Python program to calculate the area of a trapezoid
• Write a Python program to calculate the area of a parallelogram
• Write a Python program to calculate surface volume and area of a cylinder
• Write a Python program to returns sum of all divisors of a number
• Write a Python program to find the maximum and minimum numbers from the specified decimal numbers.

Module – 4
• What is File function in python? What is keywords to create and write file.
• Write a Python program to read an entire text file.
• Write a Python program to append text to a file and display the text.
• Write a Python program to read first n lines of a file.
• Write a Python program to read last n lines of a file.
• Write a Python program to read a file line by line and store it into a list
• Write a Python program to read a file line by line store it into a variable.
• Write a python program to find the longest words.
• Write a Python program to count the number of lines in a text file.
• Write a Python program to count the frequency of words in a file.
• Write a Python program to write a list to a file.
• Write a Python program to copy the contents of a file to another file.
• Explain Exception handling? What is an Error in Python?
• How many except statements can a try-except block have? Name Some built-in exception classes:
• When will the else part of try-except-else be executed?
• Can one block of except statements handle multiple exception?
• When is the finally block executed?
• What happens when „1‟== 1 is executed?
• How Do You Handle Exceptions With Try/Except/Finally In Python? Explain with coding snippets.
• Write python program that user to enter only odd numbers, else will raise an exception.
• What are oops concepts? Is multiple inheritance supported in java
• How to Define a Class in Python? What Is Self? Give An Example Of A Python Class
• Write a Python class named Rectangle constructed by a length and width and a method which will compute the area of a rectangle
• Write a Python class named Circle constructed by a radius and two methods which will compute the area and the perimeter of a circle
• Write a Python class named Circle constructed by a radius and two methods which will compute the area and the perimeter of a circle
• Explain Inheritance in Python with an example? What is init? Or What Is A Constructor In Python?
• What is Instantiation in terms of OOP terminology?
• What is used to check whether an object o is an instance of class A?


What relationship is appropriate for Course and Faculty?
• What relationship is appropriate for Student and Person?

Module – 5
• Why Django should be used for web-development? Explain how you can create a project in Django?
• How to check installed version of django?
• Mention what command line can be used to load data into Django?
• Explain what does django-admin.py make messages command is used for?
• What is .Django URLs?make program to create django urls
• What is a QuerySet?Write program to create a new Post object in database:
• Mention what command line can be used to load data into Django?
• Explain what does django-admin.py make messages command is used for?

Make Django application to demonstrate following things o 1)There will be 2 modules(Admin,Product manager)
o 2) Admin can add product name (ex.Product id and product name) ex. (1, Samsung), (2, Apple)…etc. Data should store in
Product_mst table with product id as primary key o 3)Admin can add product subcategory details Like (Product price, product image,
o Product model, product Ram) data should store in
Product_sub_cat table o 4)Admin can get product name as foreign key from product_mst table in product_sub_category_details page
o 5)Admin can view, update and delete all registered details of product
o 6)product manager can search product on search bar and get all details about product

Reviews

There are no reviews yet.

Be the first to review “Python – Solved”

Your email address will not be published. Required fields are marked *

Related products