इस पोस्ट में मैं आपको Python print () Function के बारे में बताने वाला हूँ. इससे पहले हमने देखा की Python क्या होता है, Python के Applications, Python के Features इत्यादि. अगर अभी तक आपने इन पोस्ट्स को नहीं पढ़ा है तो यंहा क्लिक करके अभी पढ़े.
Python print() Function
print() function Syntax:
print(object(s), sep=separator, end=end, file=file, flush=flush)
print() Function Parameters:
print() function में bracket के अंदर लिखे गए elements को parameters कहा जाता है. इसके जितने भी parameters होते है वो optional होते है यानी ये आप के ऊपर निर्भर करता है की आप print() function को कोई parameter देना चाहते है या नहीं.
ऊपर दिए गए इमेज में लाल रंग से लिखे गए टेक्स्ट print() function के parameters है.
print() Function Examples:
Program:
Output:
print() function के अंदर डबल कोट्स में लिखे गए टेक्स्ट्स हमे ज्यूँ के त्यूं output में मिल जाते है. अगर आपको एक लाइन से ज्यादा print करवाना है तो आपको डबल कोट्स की जगह ट्रिपल कोट्स का यूज़ करना पड़ेगा.
Example: print(”’Twinkle, twinkle, little star
How I wonder what you are
Up above the world so high
Like a diamond in the sky”’)
Program:
Output: