Python-Codes

所属分类:Python编程
开发工具:Python
文件大小:0KB
下载次数:0
上传日期:2023-09-07 18:39:52
上 传 者sh-1993
说明:  这是我的Python编程代码,
(Here is my Python Programming Codes,)

文件列表:
7000 & 6000.py (126, 2023-11-18)
Addition Complex no. .py (194, 2023-11-18)
Age negative ex.py (312, 2023-11-18)
Area & Perimeter.py (673, 2023-11-18)
Arithmetic Error.py (1386, 2023-11-18)
Break a number.py (85, 2023-11-18)
Check Prime module.py (422, 2023-11-18)
Common.py (271, 2023-11-18)
Concatenate.py (252, 2023-11-18)
Countchardict.py (340, 2023-11-18)
Cricketdict.py (711, 2023-11-18)
Decimal Equivalent.py (205, 2023-11-18)
DigitSum.py (66, 2023-11-18)
Divisible by 5&7.py (479, 2023-11-18)
Duplicate.py (359, 2023-11-18)
Factorial.py (127, 2023-11-18)
Factors.py (164, 2023-11-18)
Fibonacci.py (189, 2023-11-18)
File Word count.py (187, 2023-11-18)
File copy binary.py (732, 2023-11-18)
FindFibonacci.py (329, 2023-11-18)
GCD & LCM func.py (638, 2023-11-18)
GCD & LCM.py (290, 2023-11-18)
GCD.py (241, 2023-11-18)
Greatest num.py (356, 2023-11-18)
Input.py (257, 2023-11-18)
Integral dict.py (335, 2023-11-18)
Interest.py (256, 2023-11-18)
LCM.py (344, 2023-11-18)
LICENSE (1072, 2023-11-18)
Last Char.py (137, 2023-11-18)
Num below.py (404, 2023-11-18)
Palindrome.py (115, 2023-11-18)
Pattern star.py (232, 2023-11-18)
PatternRightAllign.py (156, 2023-11-18)
Print.py (147, 2023-11-18)
Quadratic Roots.py (684, 2023-11-18)
Read no. Ex.py (221, 2023-11-18)
Series.py (204, 2023-11-18)
... ...

## Python codes

Day 1

Introduction to Python Programming

1. Write a program to convert temperature from degree Celsius to degree Fahrenheit. 2. Write a program to calculate the area and perimeter of a rectangle. 3. Write a program to swap the value of two variables using a third variable and without using a third variable. 4. Write a program to swap two numbers using bitwise operators. 5. Write a program to rotate the value of x, y, and z such that x has the value of y, y has the value of z and z has the value of x. 6. Write a program to display the following numbers: 5678, 678, 78, 8, where the given number is 5678. 7. Write a program to add two complex numbers by reading the numbers from the user. 8. Write a program to accept the principal amount, rate of interest, and duration from the user. Calculate the interest amount and the total amount (principal + interest).

Day 2

Conditional Statements

9. Write a program to sort three numbers using if-elif-else. 10. Write a program to calculate simple interest with the following conditions: If the principal amount is less than 2,00,000 the interest rate is 10%. If the principal amount is 2,00,000 -10,00,000 the interest rate is 12%. If the principal amount is greater than 10,00,000 the interest rate is 15%. 11. Write a program to print the following patterns: ![image](https://github.com/apu52/Python-Codes/assets/114172928/ad2e953e-dc61-4994-8bbf-bcd58fb6dcde) 12. Write a program using a while loop to print all the odd numbers within a given range. 13. Write a program to compute the GCD of two integer numbers. 14. Write a program to print the decimal equivalents of 1/2, 1/3, 1/4,. ........................... , 1/10 using for loop.

Day 3

Control Statements

15. Write a program to check whether a given number is a prime number or not. 16. Write a program to check whether a given number is an Armstrong number or not. 17. Write a program to get the LCM of two positive integers. 18. Write a program to find the sum of all prime numbers within a given range. 19. Write a program that prompts users to enter numbers. This process repeats until the user enters -1. Finally, the program prints the count of prime and composite numbers entered. 20. Write a program to find the sum of the even-valued terms of the Fibonacci series up to 100.

Day 4

Strings

21. Write a program to count the number of each vowel in a sentence. 22. Write a program to read a string and check whether the string is a palindrome or not. 23. Write a program to get a string from a given string where all occurrences of the last character have been changed to ‘*’, except the last character. 24. Write a program to count the occurrences of a word in a given sentence. 25. Write a program to get all substrings of a given string. 26. Write a program to detect whether two strings are anagrams or not.

Day 5

Lists

27. Write a program to find the maximum and minimum of a list of numbers without using built-in functions. 28. Write a program to multiply two matrices as nested lists. 29. Write a program to find the union of two lists. 30. Write a program to concatenate two lists using list comprehension. 31. Write a program to create a list from two given lists ‘list1’ and ‘list2’ of numbers such that it contains numbers that are present in ‘list2’ but not in ‘list1’. 32. Write a program to find the distinct pair of numbers whose product is odd from a list of integers.

Tuples

33. Write a program to accept a sequence of comma-separated numbers from the user and generate a tuple with those numbers. 34. Write a program to add elements in a tuple without using built-in functions. 35. Write a program to calculate the mean of elements in a tuple of integers. 36. Write a program to display unique and duplicate elements of a tuple. 37. Write a program to count the frequency of all the elements in a tuple. 38. Write a program to find the distinct pair of numbers whose product is even from a tuple of integers.

Day 6

Dictionaries

39. Write a program to create a dictionary that contains (i, i*i) such that i is an integral number between 1 and n (both included). 40. Write a program to count the numbers of characters in a string and store them in a dictionary. 41. Write a program to create a dictionary by combining two lists ‘name’ for employee name and ‘salary’ for employee salary. Use the list ‘name’ as the key and ‘salary’ as the value of dictionary elements. 42. Write a program to input player's name (string) and runs (integer) scored for n number of players where n should be input from the keyboard. Store the player’s details in a dictionary called 'cricket'. After preparing the dictionary, input the player's name and print the runs scored by the player otherwise returns'-1' if the player's name is not found. 43. Write a program to sort (ascending order) a dictionary by value. 44. Write a program to merge two dictionaries.

Day 7

Functions

45. Write a program to find GCD and LCM of two numbers by defining a function to compute GCD and LCM. 46. Write a program to define a function that accepts a string and calculates the number of uppercase letters and lowercase letters. 47. Write a program to find all the unique elements of a list by defining a function. 48. Write a program to find all the numbers divisible by 5 and 7 between the given range using the lambda function. 49. Write a program to print the even numbers from a given list using the lambda function 50. Write a program to find the maximum value from a list using the lambda function.

Day 8

Modules, Packages

51. Create a module to check if a passed string is a palindrome or not. Write a program to find whether a string is a palindrome or not using this module. 52. Create a module to check whether a number is a prime or not. Write a program to find the prime number between two limits using this module. 53. Create a module to find the factorial of a number and import the module from the main program to find the factorial of a given number. 54. Write a program to find the mean, median, and standard deviation of a list of random numbers between 1 and 10. 55. Write a program to shuffle elements of a list of random numbers between given ranges. 56. Write a program to create a list of random numbers using list comprehension.

Day 9

Exception Handling

57. Write a program to read a number from the user. If the number is positive or zero, print it, otherwise raise an exception. 58. Write a program to read two numbers from the user and perform basic mathematical operations (addition, multiplication, subtraction, division) by handling all possible exceptions. 59. Write a program to read a number from the user and print its square. Generate KeyboardIntrrupt exception if Ctrl + C is pressed instead of a number. 60. Write a program to print random numbers infinitely. Raise the StopIteration exception after displaying 10 numbers to exit from the program. 61. Write a program to generate a random number. Raise a user-defined exception if the number is below 0.5. 62. Write a program to read the age of a person and raise exceptions if age is negative.

Day 10

File Handling

63. Write a program to accept a file name from the user and count the number of words present in the file. 64. Write a program to print each line of a file in reverse order. 65. Write a program to reverse the content of a file and store it in another file. 66. Write a program to copy the first 100 characters of a binary file into another. 67. Write a program to copy the content of the text file to another file by converting all lowercase characters to uppercase. 68. Write a program to copy one Python script into another in such a way that all comment lines are skipped and not copied to the destination file.

近期下载者

相关文件


收藏者