Python print Function With Examples

इस पोस्ट में मैं आपको Python print () Function के बारे में बताने वाला हूँ. इससे पहले हमने देखा की Python क्या होता है, Python के Applications, Python के Features इत्यादि. अगर अभी तक आपने इन पोस्ट्स को नहीं पढ़ा है तो यंहा क्लिक करके अभी पढ़े.

print function in python


Python print() Function

Python में किसी भी तरह का डाटा को screen पर print करने के लिए print() function का इस्तेमाल किया जाता है. ये एक inbuilt function है जिसका यूज़ हम अपने Python program में स्क्रीन पर Output देने के लिए करते है.

print() function Syntax:

print(object(s), sep=separator, end=end, file=file, flush=flush)

python print function


print() Function Parameters:

print() function में bracket के अंदर लिखे गए elements को parameters कहा जाता है. इसके जितने भी parameters होते है वो optional होते है यानी ये आप के ऊपर निर्भर करता है की आप print() function को कोई parameter देना चाहते है या नहीं.

python print function

ऊपर दिए गए इमेज में लाल रंग से लिखे गए टेक्स्ट print() function के parameters है.


print() Function Examples:

Program:

print function in python

Output:

print function example

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:

PRINT FUNCTION

Output:

python print function


 

Leave a Comment