پایتونیک، روشی برای کوتاه کردن و خوانا کردن کدها پایتون زبان بسیار قدرتمندی است و تقریبا هر برنامه ای می توان با آن نوشت. اما قدرت پایتون در ساده نویسی و کوتاه کردن دستورات برنامه است. فرض کنید می خواهیم برنامه ای بنویسیم که اعداد زوج مابین 0 تا 100 را با یکدیگر جمع کند. ساختار برنامه نویسی چیزی شبیه زیر خواهد بود: total=0 for i in range(1,100): if i%2==0: total+= i print(total) اگر بخواهیم کمی کد فوق را خلاصه کنیم از ساختار زیر هم می توانیم استفاده کنیم: total=0 for i in range(1,100): total+= i if i%2==0 else 0 print(total)
اما تمام کدهای فوق را می توانیم با یک خط زیر عوض کنیم: print(sum(i if i%2==0 else 0 for i in range(1,100)))
کد فوق احتمالا خلاصه ترین و خوانا ترین کدی است که می توان برای این برنامه نوشت، به این شیوه کد نویسی پایتونیک گفته می شود.
پایتونیک، روشی برای کوتاه کردن و خوانا کردن کدها پایتون زبان بسیار قدرتمندی است و تقریبا هر برنامه ای می توان با آن نوشت. اما قدرت پایتون در ساده نویسی و کوتاه کردن دستورات برنامه است. فرض کنید می خواهیم برنامه ای بنویسیم که اعداد زوج مابین 0 تا 100 را با یکدیگر جمع کند. ساختار برنامه نویسی چیزی شبیه زیر خواهد بود: total=0 for i in range(1,100): if i%2==0: total+= i print(total) اگر بخواهیم کمی کد فوق را خلاصه کنیم از ساختار زیر هم می توانیم استفاده کنیم: total=0 for i in range(1,100): total+= i if i%2==0 else 0 print(total)
اما تمام کدهای فوق را می توانیم با یک خط زیر عوض کنیم: print(sum(i if i%2==0 else 0 for i in range(1,100)))
کد فوق احتمالا خلاصه ترین و خوانا ترین کدی است که می توان برای این برنامه نوشت، به این شیوه کد نویسی پایتونیک گفته می شود.
You can’t. What you can do, though, is use WhatsApp’s and Telegram’s web platforms to transfer stickers. It’s easy, but might take a while.Open WhatsApp in your browser, find a sticker you like in a chat, and right-click on it to save it as an image. The file won’t be a picture, though—it’s a webpage and will have a .webp extension. Don’t be scared, this is the way. Repeat this step to save as many stickers as you want.Then, open Telegram in your browser and go into your Saved messages chat. Just as you’d share a file with a friend, click the Share file button on the bottom left of the chat window (it looks like a dog-eared paper), and select the .webp files you downloaded. Click Open and you’ll see your stickers in your Saved messages chat. This is now your sticker depository. To use them, forward them as you would a message from one chat to the other: by clicking or long-pressing on the sticker, and then choosing Forward.
Start with a fresh view of investing strategy. The combination of risks and fads this quarter looks to be topping. That means the future is ready to move in.Likely, there will not be a wholesale shift. Company actions will aim to benefit from economic growth, inflationary pressures and a return of market-determined interest rates. In turn, all of that should drive the stock market and investment returns higher.