Skip to main content

Input and Output statements in Python

In Python, input and output are handled using built-in functions input() and print().
पायथन में, इनपुट और आउटपुट को अंतर्निहित फ़ंक्शन इनपुट() और प्रिंट() का उपयोग करके नियंत्रित किया जाता है।

1.) input():-
To take input from the user, we can use the `input()` function. This function reads a line usually from a standard input device (keyboard) and returns it as a string to a variable. By default, `input()` returns data as a string, so if we need an integer or a float, we must convert it by type conversion.
1.) इनपुट():-
उपयोगकर्ता से इनपुट लेने के लिए, हम `इनपुट()` फ़ंक्शन का उपयोग कर सकते हैं। यह फ़ंक्शन आमतौर पर एक मानक इनपुट डिवाइस (कीबोर्ड) से एक लाइन पढ़ता है और इसे एक स्ट्रिंग के रूप में एक वेरिएबल में लौटाता है। डिफ़ॉल्ट रूप से, `इनपुट()` डेटा को एक स्ट्रिंग के रूप में लौटाता है, इसलिए यदि हमें इंटीजर या फ्लोट की आवश्यकता है, तो हमें इसे टाईप कन्वर्जन द्वारा परिवर्तित करना होगा।

2.) print():-
To display output to the user, we can use the `print()` function.
2.) प्रिंट():- 
उपयोगकर्ता को आउटपुट प्रदर्शित करने के लिए, हम `प्रिंट()` फ़ंक्शन का उपयोग कर सकते हैं। 

Example 1:
#By default string input:-
name = input("Enter your name: ") #name=Rahul
print("Hello, " + name) #Hello, Rahul

Example 2:
#integer input:-
num = int(input("Enter a number: ")) #num= 100
print("You entered:", num)
#You entered: 100

Example 3:
#floating point input:-
pi = float(input("Enter a value of PI: ")) #pi=3.14
print("You entered:", pi)
#You entered: 3.14
 

Comments

Popular posts from this blog

Programming with Python Language Tutorial available in hindi and english पाइथन प्रोग्रामिंग टुटोरिअल हिंदी एवं अंग्रेजी भाषा में

 Unit -01 1. Introduction to python (पाइथन भाषा का परिचय) 2. History of Python Programming Language पाइथन प्रोग्रामिंग लैंग्वेज का इतिहास 3. Python Programming Language’s Features and Advantages पायथन प्रोग्रामिंग लैंग्वेज की प्रमुख विशेषताएं 4. Python’s Programming Language's Popularity पाइथन प्रोग्रामिंग लैंग्वेज की लोकप्रियता 5.The Future of Python Programming Language पायथन प्रोग्रामिंग लैंग्वेज का भविष्य 6. The Python Interpreter पायथन इंटरप्रेटर 7. The Python IDLE पाइथन आईडीएलई 8. Installation process of Python IDLE पायथन आईडीएलई की इंस्टालेशन प्रक्रिया 9. Dynamically typed and strongly typed features of python गतिशील रूप से टाइप और दृढ़ता से टाइप की गई भाषा पायथन 10. Basic Data Types of Python पायथन के बेसिक डेटा टाइप 11. Variables in python पायथन में वेरिएबल 12. Expressions in Python पायथन में अभिव्यक्तियां 13. Statements in Python पायथन में कथन 14. Operator's in Python पायथन में ऑपरेटर्स 15. Flow of execution of a python program पाइथन प्रोग्राम के निष्पादन का प्रवाह 16...

Inbuilt Functions in Python पाइथन में अंतर्निहित फ़ंक्शन्स

Python is a powerful programming language that provides many inbuilt functions to make coding simple and efficient. These functions help programmers perform common tasks like finding length, converting characters, or checking memory addresses without writing extra code. पायथन एक शक्तिशाली प्रोग्रामिंग भाषा है जो कई अंतर्निहित (inbuilt) फ़ंक्शन्स प्रदान करती है, जिससे कोडिंग आसान और प्रभावी हो जाती है। ये फ़ंक्शन प्रोग्रामर को सामान्य कार्य करने में मदद करते हैं जैसे लंबाई निकालना, अक्षरों का रूपांतरण करना या मेमोरी एड्रेस जांचना, और इसके लिए अतिरिक्त कोड लिखने की आवश्यकता नहीं होती। (a)  id()  – Unique Identifier of an Object  किसी वस्तु का अद्वितीय पहचानकर्ता The  id()  function returns the unique memory address of an object. Every variable or object in Python is stored in memory, and  id()  helps us know where exactly it is stored. id()  फ़ंक्शन किसी ऑब्जेक्ट का अद्वितीय मेमोरी एड्रेस लौटाता है। पायथन में हर वेरिएबल या ऑब्जेक्ट मेमोरी में संग्रह...

Python Programming Language’s Features and Advantages पायथन प्रोग्रामिंग लैंग्वेज की प्रमुख विशेषताएं

Python is a versatile and popular programming language known for its simplicity and readability. It has a wide range of features that make it suitable for various types of projects. Here are some key features of the Python programming language:- पायथन एक बहुमुखी और लोकप्रिय प्रोग्रामिंग भाषा है जो अपनी सरलता और पठनीयता के लिए जानी जाती है। इसमें कई प्रकार की विशेषताएं हैं जो इसे विभिन्न प्रकार की परियोजनाओं के लिए उपयुक्त बनाती हैं। पायथन प्रोग्रामिंग भाषा की कुछ प्रमुख विशेषताएं निम्न हैं:- 1. Open Source ओपन सोर्स:-   Python is an open-source language, which encourages collaboration and allows developers to contribute to its ongoing development. पायथन एक ओपन-सोर्स भाषा है, जो सहयोग को प्रोत्साहित करती है और डेवलपर्स को इसके चल रहे विकास में योगदान करने की अनुमति देती है। 2. Integrated Development & Learning Environments एकीकृत विकास एवं अध्ययन वातावरण  (IDLEs/IDEs):-  Python has several powerful IDLEs/IDEs, such as PyCharm, VSCode, and Jupyter, that provide too...