+ 1
Guys ...i was training on loops and i was thinking of writing a program drawing this shape👇...but i kept thinking for 50 min ?!
i think that 50 minute is much time to write this program....and is that mean that i am bad in loops or what..? the shape.... 123456 12345 1234 123 12 1 12 123 1234 12345 123456
18 odpowiedzi
+ 4
I think you should use two nested for loops for the first 6 rows and two nested for loops for the last 5 rows.
+ 3
When you are in the beginning of learning new things it's normal. Just don't give up and keep learning and practice writing codes.
+ 2
Here is a oneliner for you.
https://code.sololearn.com/c8EjWc1iGg1M/?ref=app
+ 2
There are multiple way to resolve a problem... This is true in life as in programming... Remember always this.
Anyway i want post my code also 😝
https://code.sololearn.com/cNsbG2VwMGls/?ref=app
About your time for get it, dont worry its very normal 😉
+ 2
Louis Yes i have confused some code 😜... Anyway i refer to one-line expressions that make more confusion
+ 2
so what os better my code or Louis 's code?
i think his code is better than me
+ 2
Omar o
you are not asking the right questions.
Why is it better.( I am not saying mine is perfect, I am also still learning)
In my code, change the value of the variable in the top line, the program responds in a consistent manner. That means that the program is reusable.
+ 2
Dont exists a perfect code... Exist a more appropriate code for some context (execution speed, memory usage, readability, reusability etc)
+ 2
Omar o Don't think how long it took you, think "fantastic I did it". Perseverance is a great trait to have.
+ 1
one loop and some string parsing ;)
https://code.sololearn.com/cB6oyOnnaApC/?ref=app
+ 1
Try to write more parametric.
you dont use i in the loop and z is superfluos
https://code.sololearn.com/co8sg7k5sv7Q/?ref=app
https://code.sololearn.com/crT4GTmE8iXL/?ref=app
https://code.sololearn.com/c2pQPZQdOvp8/?ref=app
https://code.sololearn.com/cU59uMRT79yx/?ref=app
+ 1
Omar o
firstly - if you declare a variable in a loop then use that variable
as in
for i in range(10):
you now have the variable i in each iteration of the loop and it goes from 0 to 9.
secondly - have a look at string formatting and do not try to position everything yourself.
https://www.digitalocean.com/community/tutorials/how-to-use-string-formatters-in-JUMP_LINK__&&__python__&&__JUMP_LINK-3
+ 1
Louis thank u☺
+ 1
thanks bro☺
Duncan
0
no ....i mean that i kept thinking 50 min and in the last i reached the answer ...it is 2 loops but not nested....but now i mean 50 min is a big time to reach the answer...so is that mean that i am bad or it is normal to kept tginging for 50 min??
Jay Matthews
D⚽⚽⚽⚽7⃣7⃣7⃣
0
thank u guys....this is my loops...what is your opinion in them ..??
https://code.sololearn.com/c50xlw93l8yz/?ref=app
https://code.sololearn.com/cvzxOb1x7tee/?ref=app
https://code.sololearn.com/c8P3f0QIU2oA/?ref=app
https://code.sololearn.com/c3CT7zi3Iu5L/?ref=app
0
i didnot understand your code😅