-
-
Save cibofdevs/967df5e853c7f1755ba4920b502b7922 to your computer and use it in GitHub Desktop.
# Create an empty string and assign it to the variable lett. | |
# Then using range, write code such that when your code is run, lett has 7 b’s ("bbbbbbb"). | |
lett = '' | |
for i in range(7): | |
lett += 'b' | |
print(lett, end='') |
lett += 'b' and lett =lett+ 'b'
both are same
mr.raviprakashram
this isn't correct. based on the question, the right answer will be;
lett = ' '
for i in range(7):
lett = 'b'*7
print(lett)
so that for each iteration, 'b' is printed 7 times. I believe that is what the question is asking
A small correction to loop_lett_val.py
lett = ''
for i in range(7):
lett += 'b'
print(lett)
because indent continues to print the loop, Just for info
We
this isn't correct. based on the question, the right answer will be;
lett = ' '
for i in range(7):
lett = 'b'*7
print(lett)so that for each iteration, 'b' is printed 7 times. I believe that is what the question is asking
I felt this is the correct thing we should so based on the question asked.
If we do
lett += 'b'
It will print more number of b's what we need as per the question.
lett = ''
for i in range(7):
lett += 'b'
print(lett, end='')
lett= ' '
for i in range(7):
lett = lett+('b')
print(lett)
lett = " "
range(7)
lett = "b"*7
lett = ' '
for i in range(7):
lett =lett+ 'b'
print(lett, end=' ')