today I bring you an apparently simple question, that it's not so simple as it seems(for me at least)!
Imagine I have the following list of integers:
num = [3,1,1,2]
And I want to print "$" corresponding with the height i.e:
&
& &
& & & &
for i in num:
print("#"*i)
prints this:
& & &
&
&
& &
However I want the former displayed!
I tried this:
for i in range(1, max(num)+1): # loops through the rows
for j in num:
if j == i:
print("#")
else:
print("")
But after a while I understood that the condition doesn't make any sense, because I'm comparing row numbers with the height!
I tried other stuff but none of them worked properly, I would appreciate if someone could help me out! Thanks
[1, 3, 1, 1, 2, 5]
?$
,&
, or#
your question is insconsistent the entire way.