✅ یک نوع متغیر را مشخص کنید. ممکن است مواقعی پیش بیاید که بخواهید یک نوع بر روی یک متغیر مشخص کنید. این را میتوان با ریخته گری انجام داد. پایتون یک زبان شی گرا است و به همین دلیل از کلاسها برای تعریف انواع دادهها از جمله انواع اولیه آن استفاده میکند. بنابراین ریخته گری در پایتون با استفاده از توابع سازنده انجام می شود:
دستور int() یک عدد صحیح از یک لفظ صحیح، یک حرف شناور (با حذف تمام اعشار)، یا یک رشته حرفی (به شرط اینکه رشته یک عدد کامل را نشان دهد) میسازد.
دستور float() یک عدد شناور از یک عدد صحیح واقعی، یک float literal یا یک رشته واقعی (به شرط اینکه رشته نشان دهنده یک شناور یا یک عدد صحیح باشد) میسازد.
دستور str() رشته ای را از طیف گسترده ای از انواع داده ها، از جمله رشته ها، حرف های اعداد صحیح و حرف های شناور می سازد.
🟡 مثال صحیح x = int(1) y = int(2.8) z = int("3") print(x) print(y) print(z) خروجی پایتون: ۱ ۲ ۳ شناور x = float(1) y = float(2.8) z = float("3") w = float("4.2") print(x) print(y) print(z) print(w) خروجی پایتون 1.0 2.8 3.0 4.2 رشته x = str("s1") y = str(2) z = str(3.0) print(x) print(y) print(z) خروجی پایتون s1 2 3.0 ⬅️ ادامه دارد....
✅ یک نوع متغیر را مشخص کنید. ممکن است مواقعی پیش بیاید که بخواهید یک نوع بر روی یک متغیر مشخص کنید. این را میتوان با ریخته گری انجام داد. پایتون یک زبان شی گرا است و به همین دلیل از کلاسها برای تعریف انواع دادهها از جمله انواع اولیه آن استفاده میکند. بنابراین ریخته گری در پایتون با استفاده از توابع سازنده انجام می شود:
دستور int() یک عدد صحیح از یک لفظ صحیح، یک حرف شناور (با حذف تمام اعشار)، یا یک رشته حرفی (به شرط اینکه رشته یک عدد کامل را نشان دهد) میسازد.
دستور float() یک عدد شناور از یک عدد صحیح واقعی، یک float literal یا یک رشته واقعی (به شرط اینکه رشته نشان دهنده یک شناور یا یک عدد صحیح باشد) میسازد.
دستور str() رشته ای را از طیف گسترده ای از انواع داده ها، از جمله رشته ها، حرف های اعداد صحیح و حرف های شناور می سازد.
🟡 مثال صحیح x = int(1) y = int(2.8) z = int("3") print(x) print(y) print(z) خروجی پایتون: ۱ ۲ ۳ شناور x = float(1) y = float(2.8) z = float("3") w = float("4.2") print(x) print(y) print(z) print(w) خروجی پایتون 1.0 2.8 3.0 4.2 رشته x = str("s1") y = str(2) z = str(3.0) print(x) print(y) print(z) خروجی پایتون s1 2 3.0 ⬅️ ادامه دارد....
In 2014, Pavel Durov fled the country after allies of the Kremlin took control of the social networking site most know just as VK. Russia's intelligence agency had asked Durov to turn over the data of anti-Kremlin protesters. Durov refused to do so. If you initiate a Secret Chat, however, then these communications are end-to-end encrypted and are tied to the device you are using. That means it’s less convenient to access them across multiple platforms, but you are at far less risk of snooping. Back in the day, Secret Chats received some praise from the EFF, but the fact that its standard system isn’t as secure earned it some criticism. If you’re looking for something that is considered more reliable by privacy advocates, then Signal is the EFF’s preferred platform, although that too is not without some caveats. Again, in contrast to Facebook, Google and Twitter, Telegram's founder Pavel Durov runs his company in relative secrecy from Dubai. On February 27th, Durov posted that Channels were becoming a source of unverified information and that the company lacks the ability to check on their veracity. He urged users to be mistrustful of the things shared on Channels, and initially threatened to block the feature in the countries involved for the length of the war, saying that he didn’t want Telegram to be used to aggravate conflict or incite ethnic hatred. He did, however, walk back this plan when it became clear that they had also become a vital communications tool for Ukrainian officials and citizens to help coordinate their resistance and evacuations. You may recall that, back when Facebook started changing WhatsApp’s terms of service, a number of news outlets reported on, and even recommended, switching to Telegram. Pavel Durov even said that users should delete WhatsApp “unless you are cool with all of your photos and messages becoming public one day.” But Telegram can’t be described as a more-secure version of WhatsApp.
from us