Printing Output (print()) :-
print() Python का एक Built-in Function है, जिसका उपयोग स्क्रीन (Console) पर Output (परिणाम) प्रदर्शित करने के लिए किया जाता है। इसकी सहायता से String, Number, Boolean, Variables, Expressions तथा विभिन्न प्रकार के Data को आसानी से प्रदर्शित किया जा सकता है। print() Function Program के Execution के दौरान परिणाम (Output) को User तक पहुँचाने का सबसे सामान्य और महत्वपूर्ण माध्यम है।
English:
print() is a built-in Python function used to display output on the screen (console). It can print strings, numbers, booleans, variables, expressions, and different types of data. The print() function is the most common and important way to display the output of a program to the user during program execution.
Example 1: Printing a String -
Output
Hello World
Example 2: Printing an Integer -
print(100)
Output
100
Example 3: Printing a Float -
print(99.5)
Output
99.5
Example 4: Printing a Boolean Value -
Output
Example 5: Printing a Variable -
Output
Rahul
Example 6: Printing Multiple Variables -
Output
Rahul 18
Example 7: Printing Multiple Values -
Output
Rahul 18 True 95.5
Example 8: Printing an Expression -
Output
30
Example 9: Printing the Result of Multiplication -
Output
50
Example 10: Printing a List -
Output
[10, 20, 30]
Example 11: Printing a Tuple -
Output
(10, 20, 30)
Example 12: Printing a Dictionary -
Output
{'name': 'Rahul', 'age': 18}
Example 13: Printing a Set -
Output
{'Red', 'Green', 'Blue'}
Example 14: Printing Using sep -
sep (Separator) Parameter का उपयोग print() Function में एक से अधिक Values के बीच Separator (विभाजक) निर्धारित करने के लिए किया जाता है। यदि sep नहीं दिया जाता, तो Python By Default एक Space ( ) का उपयोग करता है।
English:
The sep (separator) parameter is used in the print() function to specify the separator between multiple values. If sep is not provided, Python uses a space ( ) as the default separator.
Example-
Output -
Python-Java-C++
Example 15: Printing Using end -
end Parameter का उपयोग print() Function में यह निर्धारित करने के लिए किया जाता है कि Output के अंत में क्या Print होगा। यदि end नहीं दिया जाता, तो Python By Default New Line (\n) का उपयोग करता है, जिससे अगला print() नई पंक्ति से शुरू होता है।
English:
The end parameter is used in the print() function to specify what should be printed at the end of the output. If end is not provided, Python uses New Line (\n) by default, so the next print() starts on a new line.
Example-1
Output -
Name Rahul