Search the Blog

Thursday, August 29, 2019

Palindrome number program in Pythan

In this post i will explain the palindome number program in python and also to expalin the same i also created a youtube video so you can check also complete step by step and also output in IDE. 

Palindrome number program in Pythan

Palindrome number program in Pythan


Palindrome No Program in Python-



num = int(input("enter a number: "))
temp = num
rev = 0while temp:
    rev = (rev * 10) + (temp % 10)
    temp = temp // 10if num == rev:
    print("No is palindrome")
else:
    print("No is not palindrome")



Output-
When entered Item is- 747
   No is Palindrome.

when entered Item is- 67
   No is notb Palindrome.


See Also-Pythan All type of program







Monday, August 26, 2019

Pyhtan * Pattern Program with Space

As all of us knows that as we used to print the pattern program in C, C++, JAVA,Net, etc. to make comfortable to the new user as we started learning that programming language.

In the same way to make confidence and learn syntax and logic writting style in Python. We can practice as many prgram for this i am showing to all of you more than 20 pattern program code in Python.
You can copy and paste these code and even test at your own system. Users can modify these Codes too.

Python pattern program with space and Star(*) 

Pyhtan * Pattern Program with Space

Program Code-


def python_pattern(n):
    # outer loop will handle number of rows    
    # n in this case    
    for i in range(0, n):
        # inner loop will handle number 
          of columns for space printing        
       for k in range(0, n-i):
            # printing stars            
            print("  ", end="")
        # inner loop will handle number of columns 
        for star printing        
       for j in range(0, i + 1):
            # printing stars
            print("* ", end="")
            # ending line after each row
        print("\r")
    # Driver Code
n = 6python_pattern(n)





Output-


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


Saturday, August 24, 2019

Python Pattern Program Example With Code

As all of us knows that as we used to print the pattern program in C, JAVA,Net etc. To make comfortable and understand to the new user in Pyhton we started learning that programming language.

In the same way to make confidence, Comfortable and learn syntax and logic writing style in Python we can practice for this i am showing to all of you more than 20 pattern program code in Python.
You can copy and paste these code  and even test at your own system. Users can modify these Codes too accrding to requirement.

---------------------------------------------------------------------------------
Example 1-
Python pattern program example

...................................................................................................................................................................
Source Code- Pycharm IDE

# Function to demonstrate printing pattern
  def python_pattern(n):
    # outer loop to handle number of rows    
    # n in this case  
        for i in range(0, n):

        # inner loop to handle number of columns       
        # values changing acc. to outer loop       
             for j in range(0, i + 1):
             # printing stars           
               print("* ", end="")

            # ending line after each row      
         print("\r")

    # Driver Code
    # No of rows variable length
    n = 6
    python_pattern(n)


Output-

F:\web\venv\Scripts\python.exe F:/web/pattern.py
* * 
* * * 
* * * * 
* * * * * 
* * * * * * 

Process finished with exit code 0




Translate