Skip to content

TalhaAhmad-Codes/10-Python-Programs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 

Repository files navigation


10 Python Mini-projects


Questions

  1. Write a program to calculate average of n numbers. Create a function for that and use *args parameter to calculate the average. Solution
  2. Write a program to determine whether a given number is prime of not. Solution
  3. Write a program to create a list of 1st 50 prime numbers. Solution
  4. Write a program to calculate sum of both 1st 100 even and odd numbers. Create separate functions for that. Solution
  5. Create a class Complex to handle complex numbers of format a + bi. Use operator overloading for addition, subtraction, multiplication and division between these numbers. Solution
  6. Create some classes name "Decimal" and "Binary". Write methods to do conversion from Decimal to Binary and vice versa. Follow these rules: Solution

Decimal: Has base 10, contains digits in range 0 to 9.

Binary: Has base 2, contains digits 0 and 1.

  1. Create a simple Stone, Paper, Scissor game in console/terminal. You must use your own logic to check for win/lose/draw. You can use random module to create a basic AI opponent. Solution
  2. Create a program to calculate area of different shapes such as triangle, square, rectangle, and circle. Create a class for each shape to hold basic information. Then, write method for each class to calculate area. All classes must be inherited from a base Shape class which contains a method for area calculation, which can be then override inside child classes. Solution
  3. Create a program to print following basic patterns (inside their own functions, then print them all as following order): Solution
*****
****
***
**
*

*
**
***
****
*****

*****
 ****
  ***
   **
    *

*****
*
***
*
*****
  1. Create a program to print the following pattern: Solution
**********
*|======|*
*|=~~~~=|*
*|=¦×צ=|*
*|=¦×צ=|*
*|=<__>=|*
*|======|*
*|======|*
**********

About

Solution of 10 Python practice questions given to Areeb-Code

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages