Dec-20-2017, 11:40 PM
(This post was last modified: Dec-20-2017, 11:42 PM by flatman123.)
Sorry about that:
thanks for that, i'll try a few things out and let you know.
def inverted_tri(t): another_astk = 0 space = 30 if type(t) == str: t = int(t) # if end-users enters a string, this converts it to an integer for x in reversed(range(t)): if x % 2 == 1: print(' ' * space,'#' * x) space = space + 1 inverted_tri(' ')
(Dec-20-2017, 08:44 PM)wavic Wrote: Hello!
First, put your code between Python code tags ( BBcode )! To preserve indentation use CTRL+SHIFT+V key combo to paste the code.
An empty string cannot be converted into an integer. The string is 't', right? You can check for an empty string by if statement easy:if t:
. This will return False if't' == ""
. Also, you can check if the strings contain digits only byt.isdigit()
.
Ref: https://docs.python.org/3.5/library/stdt...ng-methods
thanks for that, i'll try a few things out and let you know.