EmSAT Achieve Exam  >  EmSAT Achieve Notes  >  Python for EmSAT Achieve  >  Code: Star Pattern Solving

Code: Star Pattern Solving | Python for EmSAT Achieve PDF Download

1. Write a python program to print following star pattern: 

*      *      *      *      *

*      *      *      *      *

*      *      *      *      *

*      *      *      *      *

*      *      *      *      *
Code:

n=5

for i in range(n):

   for j in range(n):

      print('*', end=' ')

   print()


2. Write a python program to print following pattern:

*     

*      *      

*      *      *   

*      *      *      *    

*      *      *      *      *
Code:

n = 5 

for i in range(n): 

   for j in range(i+1): 

      print('*', end=' ')

   print()


3. Write a python code to print following star pattern:

*      *      *      *      *

*      *      *      *

*      *      *   

*      *  

*
Code:  

n = 5 

for i in range(n): 

   for j in range(i, n): 

      print('*', end=' ')

   print()


4. Write a python code to print following pattern: 

                                *

                        *      *

                *      *      *

        *      *      *      *

*      *      *      *      *      
Code:

n = 5 

for i in range(n): 

  for j in range(i, n): 

     print(' ', end=' ') 

  for j in range(i+1):

     print('*', end=' ')

  print()


5. Write a python program to print following star pattern:

*      *      *      *      *

        *      *      *      *

                *      *      *

                        *      *

                                *    
Code:

n = 5 

for i in range(n): 

   for j in range(i+1): 

      print(' ', end=' ') 

   for j in range(i, n):

      print('*', end=' ')

   print()


6. Write a python program to print following hill star pattern: 

                                *

                        *      *      *

                *      *      *      *      *

        *      *      *      *      *      *      *

*      *      *      *      *      *      *      *      *  
Code:

n = 5 

for i in range(n): 

   for j in range(i, n): 

      print(' ', end=' ') 

   for j in range(i):

      print('*', end=' ')

   for j in range(i+1):

      print('*', end=' ')

   print()


7. Write a python program to print revers hill star pattern: 

*      *      *      *      *      *      *      *      *

        *      *      *      *      *      *      *

                *      *      *      *      *

                        *      *      *

                                *    
Code:

n = 5 

for i in range(n): 

   for j in range(i+1): 

      print(' ', end=' ') 

   for j in range(i, n-1):

      print('*', end=' ')

   for j in range(i, n):

      print('*', end=' ')

   print()


8. Write a python code to print Dimond pattern with star: 

                                *

                        *      *      *

                *      *      *      *      *

        *      *      *      *      *      *      * 

*      *      *      *      *      *      *      *      *

        *      *      *      *      *      *      *

                *      *      *      *      *

                        *      *      *

                                *    
Code:

n = 5 

for i in range(n-1): 

   for j in range(i, n): 

      print(' ', end=' ') 

   for j in range(i):

      print('*', end=' ')

   for j in range(i+1): 

      print('*', end=' ')

   print() 

for i in range(n): 

   for j in range(i+1): 

      print(' ', end=' ') 

   for j in range(i, n-1):

      print('*', end=' ')

   for j in range(i, n):

      print('*', end=' ')

   print()

The document Code: Star Pattern Solving | Python for EmSAT Achieve is a part of the EmSAT Achieve Course Python for EmSAT Achieve.
All you need of EmSAT Achieve at this link: EmSAT Achieve
49 videos|38 docs|18 tests

Top Courses for EmSAT Achieve

49 videos|38 docs|18 tests
Download as PDF
Explore Courses for EmSAT Achieve exam

Top Courses for EmSAT Achieve

Signup for Free!
Signup to see your scores go up within 7 days! Learn & Practice with 1000+ FREE Notes, Videos & Tests.
10M+ students study on EduRev
Related Searches

Summary

,

shortcuts and tricks

,

ppt

,

Sample Paper

,

practice quizzes

,

Important questions

,

Objective type Questions

,

MCQs

,

Free

,

past year papers

,

mock tests for examination

,

study material

,

pdf

,

Code: Star Pattern Solving | Python for EmSAT Achieve

,

Semester Notes

,

Extra Questions

,

Previous Year Questions with Solutions

,

Viva Questions

,

Exam

,

Code: Star Pattern Solving | Python for EmSAT Achieve

,

Code: Star Pattern Solving | Python for EmSAT Achieve

,

video lectures

;