Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
crown pattern
Language:
Ada
Assembly
Bash
C#
C++ (gcc)
C++ (clang)
C++ (vc++)
C (gcc)
C (clang)
C (vc)
Client Side
Clojure
Common Lisp
D
Elixir
Erlang
F#
Fortran
Go
Haskell
Java
Javascript
Kotlin
Lua
MySql
Node.js
Ocaml
Octave
Objective-C
Oracle
Pascal
Perl
Php
PostgreSQL
Prolog
Python
Python 3
R
Rust
Ruby
Scala
Scheme
Sql Server
Swift
Tcl
Visual Basic
Layout:
Vertical
Horizontal
#python 3.5.2 # Python implementation to # print Crown pattern # Function to print # crown pattern def crown(length, height) : for i in range(0, height) : for j in range(0, length) : # for first row, print '*' # i.e, for top part of crown if (i == 0) : # print '*' at first, # middle and last column if (j == 0 or j == height or j == length - 1) : print ("*", end = "") else : print (" ", end = "") # print '*' at base of # crown i.e, for last row elif (i == height - 1) : print ("*", end = "") # fill '#' to make # a perfect crown elif ((j < i or j > height - i) and (j < height + i or j >= length - i)) : print ("*", end = "") else : print (" ", end = "") print () # Driver code # length of crown length = 125 # height of crown height = int((length - 1) / 2) # function calling crown(length, height) # This code is contributed by # Deepak
[
+
]
Show input
Absolute running time: 0.16 sec, cpu time: 0.1 sec, memory peak: 7 Mb, absolute service time: 0,17 sec
edit mode
|
history
|
discussion