Giter VIP home page Giter VIP logo

problem-solving-python's Introduction

Problem Solving - Basic Python

The objective of this repo is to solve problems using basic programming skills i.e variables, conditions, iterations and arrays.

Problems:

  • Hello World
  • Prime Numbers
  • Triangle/Diamond Problems
  • Maze Game
  • Binary to Decimal and Decimal to Binary
  • Binary Numbers Addition
  • Matrix Addition
  • Matrix Multiplication
  • Linear Search
  • Binary Search
  • Bubble Sort
  • Palindrome
  • Fibonacci series
  • Find armstrong number

Feel free to add problems by opening pull requests.


If anyone like to compile any problem, just write following lines in terminal

python3 <project_name>.py
$ python3 helloworld.py 
Hello World
$ python3 prime-number.py
Enter a positive integer number: 10
2  is a prime number
3  is a prime number
4  is a prime number
5  is a prime number
6  is not a prime number
7  is a prime number
8  is not a prime number
9  is not a prime number
$ python3 diamond-problems.py 
0 
0 0 
0 0 0 
0 0 0 0 
0 0 0 0 0 
--------------------

0 
0 0 
0 0 0 
0 0 0 0 
0 0 0 0 0 
0 0 0 0 
0 0 0 
0 0 
0 
--------------------

     0 
    0 0 
   0 0 0 
  0 0 0 0 
 0 0 0 0 0 
--------------------

     0 
    0 0 
   0 0 0 
  0 0 0 0 
 0 0 0 0 0 
  0 0 0 0 
   0 0 0 
    0 0 
     0 

User needs to move '2' to the top right '0', and '1' is a wall and '0' is a ground and user is '2'

$ python3 maze.py
['2', '0', '1', '0', '0']
['1', '0', '1', '0', '1']
['1', '0', '1', '0', '1']
['1', '0', '1', '0', '1']
['1', '0', '0', '0', '1']
Enter direction up/down/left/right: right
['0', '2', '1', '0', '0']
['1', '0', '1', '0', '1']
['1', '0', '1', '0', '1']
['1', '0', '1', '0', '1']
['1', '0', '0', '0', '1']
Enter direction up/down/left/right: down
['0', '0', '1', '0', '0']
['1', '2', '1', '0', '1']
['1', '0', '1', '0', '1']
['1', '0', '1', '0', '1']
['1', '0', '0', '0', '1']
Enter direction up/down/left/right: down
['0', '0', '1', '0', '0']
['1', '0', '1', '0', '1']
['1', '2', '1', '0', '1']
['1', '0', '1', '0', '1']
['1', '0', '0', '0', '1']
Enter direction up/down/left/right: down
['0', '0', '1', '0', '0']
['1', '0', '1', '0', '1']
['1', '0', '1', '0', '1']
['1', '2', '1', '0', '1']
['1', '0', '0', '0', '1']
Enter direction up/down/left/right: down
['0', '0', '1', '0', '0']
['1', '0', '1', '0', '1']
['1', '0', '1', '0', '1']
['1', '0', '1', '0', '1']
['1', '2', '0', '0', '1']
Enter direction up/down/left/right: right
['0', '0', '1', '0', '0']
['1', '0', '1', '0', '1']
['1', '0', '1', '0', '1']
['1', '0', '1', '0', '1']
['1', '0', '2', '0', '1']
Enter direction up/down/left/right: right
['0', '0', '1', '0', '0']
['1', '0', '1', '0', '1']
['1', '0', '1', '0', '1']
['1', '0', '1', '0', '1']
['1', '0', '0', '2', '1']
Enter direction up/down/left/right: right
cant go right
Enter direction up/down/left/right: up
['0', '0', '1', '0', '0']
['1', '0', '1', '0', '1']
['1', '0', '1', '0', '1']
['1', '0', '1', '2', '1']
['1', '0', '0', '0', '1']
Enter direction up/down/left/right: up
['0', '0', '1', '0', '0']
['1', '0', '1', '0', '1']
['1', '0', '1', '2', '1']
['1', '0', '1', '0', '1']
['1', '0', '0', '0', '1']
Enter direction up/down/left/right: up
['0', '0', '1', '0', '0']
['1', '0', '1', '2', '1']
['1', '0', '1', '0', '1']
['1', '0', '1', '0', '1']
['1', '0', '0', '0', '1']
Enter direction up/down/left/right: up
['0', '0', '1', '2', '0']
['1', '0', '1', '0', '1']
['1', '0', '1', '0', '1']
['1', '0', '1', '0', '1']
['1', '0', '0', '0', '1']
Enter direction up/down/left/right: right
['0', '0', '1', '0', '2']
['1', '0', '1', '0', '1']
['1', '0', '1', '0', '1']
['1', '0', '1', '0', '1']
['1', '0', '0', '0', '1']
Congradulations you won!!

problem-solving-python's People

Contributors

mrazam110 avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.