Level 1 : How to print the pyramid shape by using the star?


def triangel(n):
    for i in range(1,n+1):
        print(" "*(n+1)+ "*"*(i))
triange(4)

Author: Pavan | Tags: function | 1859+ Python FAQs | Share
input-function | return-statement | reading:-read(),-readline(),-readlines() | time-series-with-pandas | sum-function | string-iteration | string-concatenation | set | syntax | test-discovery | sorting-and-ranking | swapping | recursion | split | matplotlib | statement | set-operation | membership-operators-(in,-not-in) | operators | pep | odd-number | parameter | recurssion | rollback | match | round | loop | string-manipulation | single-inheritance | mathematical-function | range | string-slicing | string-formatting | round-function | python-operators | string-methods | sys-module | string-formatting | literal-characters-and-special-characters | dictionary-methods | dictionary-comprehensions | sorted | conditional-statements | slice | syntaxerror | binary-operation | regular-expression | while-else-loop | boolean-masking | context-manager | __all__-attribute | built-in | destructor | bitwise-operator | classes | list-method | loops | design-principle | data-structure | scientific-notation | typeerror | control-statement | access-modifier | using-assertions-(assertequal,-assertraises) | __future__ | thread | compute | conditional-statement | version-check | data-structures | dataframe-and-series-objects | logical-operator | mysql | attribute | sorting | min-function | methods | complex | identity-operator | mutable | tuples | list-slicing | python | while-loops | id-function | using-else-and-finally | else | mathematics | data-type | control-flow | operator-and | anchors-(^,-$) | function | python-repl | string | list-join | stack | collection | multiple-inheritance | operand | pass | decorator | numeric | multiple-inheritance | using-lists-as-stacks | gil | array | print-statement | def | comparison | import-method | implementation | dicts | comment | integers | counter-function | file-handling | operations | package-management | lists | iterator | exception | control-flow | overriding-methods | static-method | creating-custom-modules | center | debugging | matrix | syntax-error | list-mutation | introduction-to-threads | benefit | generators | expression | immutability | for | datetime.date,-datetime.time,-datetime.datetime | precedence | regex | python-history | condition | regular-expressions | working-with-file-paths | shallow-copy | difference-between-threads-and-processes | tuple-unpacking | reading-and-writing-large-files-efficiently | choice | logical-operation | counter | data-type | min-max-function | version | expand-tab | functional-programming | formal-and-actual-parameter | directory-operations | memory | python-django | logical-operator | reading-and-writing-files | type-conversion | async | file-handling | math | method | sys | arbitrary-arguments-(*args,-**kwargs) | frozenset | pseudocode | with-statement | dictionary | default-mutable-argument | using-yield-in-functions | magic-method | name-mangling | oop | yield | init | intering | matrix-list-comprehension | thread-synchronization | function-and-scope | complex-number | collections | factorial-function | oops | descriptors | join | data-types | identifier | quantifiers-(*,-+,-?,-{}) | multiple-except-blocks | using-os-and-pathlib-modules | higher-order-function | error-handling | deep-copy | comprehension | datatype | method-overloading | iterable | class-and-object | binary | encoding | copy | software-design | advanced-file-operations | heap-memory | data_structure | slicing | head-and-tail | append | datetime | introduction-to-multiprocessing | sets | list-comprehensions | logical-operators | type-conversion-and-casting | pandas | boolean-and-non-boolean | tuple | nested-loop | postfix | built-in-modules | string-method | string-method | lambda-functions | virtual-environment | zip | numpy | global-variable | constructor | polymorphism | __init_subclass__ | arithmetic-operation | inherit | asyncio | function-argument | thread-safe-data-structures-(queue.queue) | aggregating-data-with-functools.reduce() | bitwise | virtual-environment | strings | built-in-function | zip-function | random-function | lambda-function | indexing | list | raise | invalid-list | error-handling | functional-programming | string-slicing | sum() | integer | command-line-parsing | working-with-temporary-files-using-tempfile | precedence-and-associativity | zfill-function | introduction-to-python | basic | threading | filtering-and-indexing | python-module | using-the-threading-module | generator | format | staticmethod | joining-and-merging-dataframes | multiprocessing | operator | formatting-with-strftime | syntax-error | print | assignment-operator | library | call | list-methods-and-slicing | handling-missing-values-(fillna,-dropna) | generators-in-python | floating-point-precision | dictionaries | arithmetic-expression | loop-control | using-join()-and-is_alive()-methods | error | module | overflow | key-value-pairs | type_conversion | while-loop | namespace | type-conversion | class-decorators | python_version | object-attribute | application | unit-testing | default-arguments | list-comprehension | writing:-write(),-writelines() | docstring | list-vs-tuple | built-in-function | objects | assignment-operators | exponentiation | list-comprehension | installation | global-variable | loop-control-statements | file | assert | functions | parsing-with-strptime | mapping-function | defining-functions | indexing:-loc-vs-iloc | indentation | filter | identity-operator | variable | global | creating-and-starting-threads | asyncio-module | managing-directories-with-os-and-shutil | pickling--unpickling | class-and-instance-variable | filter-function | tuple-methods | bitwise-operator | inheritance | booleans | turtle | random | class-and-inheritance | data-type-conversions | operator-or | memory-management | why-use-multiprocessing-over-threading?-(gil) | namedtuple | max-min | operator-overloading | conditional-statement | data-structure | feature | update | working-with-binary-files-(rb,-wb) | exception-handling | while-and-for-loop | class | boolean | math-copysign | decimal | conversion | identity-operators-(is,-is-not) | data-structures-in-python | touples | goto-function | floats | enumerate() | else-statement | using-map()-for-transformations | fabs-function | opening-files-(open()) | encapsulation | escape-operator | int | immutable-data-type | raise-statement | list-operation | list,-set,-and-dictionary-comprehensions | interpreter | iterators | input | map-function | walking-through-directories-using-os.walk() | input-function | list-indexing | exception-handling | working-with-dates-and-times | multithreading | file_handling | global-keyword | lambda | lambdas | keyword | python-syntax-and-structure ...