What is Input and Output?

In programming, input means taking data from the user. This could be their name, age, or anything they type while running the program. Output means showing results or messages to the user.

  1. Taking Input from User

    Python provides the input() function to accept data from the user. It always returns the data as a string (text), so we may need to convert it to numbers using int() or float() functions.

    Syntax: variable_name = input("Your message here")

    🧑‍💻Example :

        name = input("Enter your site name: ")
        print("Thank you for visiting at", name)

    Output:

    Enter your site name: ShikshaSanchar

    Thank you for visiting at ShikshaSanchar

    📝 Explanation:

    input("Enter your site name: ") shows a message and waits for user input.

    The entered value is stored in the variable name.

    print("Thank you for visiting at", name)

    For example, if the user enters "ShikshaSanchar", it will display: Thank you for visiting at ShikshaSanchar

    Type Conversion with Input

    Since input() returns text, if we want to take numbers as input (like age, marks, etc.), we convert it like this:

        age = int(input("Enter your age: "))
        height = float(input("Enter your height in meters: "))

    Why conversion is needed: Without converting, mathematical operations won't work properly. For example, input("5") + input("6") will give 56 instead of 11 because strings get joined (concatenated).

  2. Displaying Output

    To display information on the screen, we use Python’s print() function. It can show strings, numbers, variables, and even expressions.

    🧑‍💻Example:

        print("Welcome to ShikshaSanchar!")
        x = 10
        print("The value of x is", x)

    Output:

    Welcome to ShikshaSanchar!

    The value of x is 10

Printing Multiple Values

We can pass many values inside print() separated by commas(,) :

🧑‍💻Example:

    platform = "ShikshaSanchar"
    topic = "Python Programming"
    print("Welcome to", platform, "for learning", topic)

Output:

Welcome to ShikshaSanchar for learning Python Programming

Using f-strings (Formatted Strings)

f-strings make it easier to include variables inside a string.

🧑‍💻Example:

    platform = "ShikshaSanchar"
    course = "Python Basics"
    print(f"Welcome to {platform}! Today’s course is {course}.")

Output:

Welcome to ShikshaSanchar! Today’s course is Python Basics.

📝 Explanation

platform = "ShikshaSanchar" assigns the word "ShikshaSanchar" to the variable platform.
course = "Python Basics" assigns the words "Python Basics" to the variable course.

The print() function uses an f-string.
An f-string lets us insert variable values directly inside the string using curly brackets { }.

So, {platform} becomes ShikshaSanchar and {course} becomes Python Basics in the output.

Why Input & Output are Important?

  • Helps make programs interactive
  • Input allows user to give their own data
  • Output helps to display results, messages, and errors
  • Both are needed in almost every program

Summary:

  • input() is used to take input from the user
  • print() is used to show output on the screen
  • Input is always taken as string → convert it when needed
  • f-strings are helpful for neat output formatting

Welcome to ShikshaSanchar!

ShikshaSanchar is a simple and helpful learning platform made for students who feel stressed by exams, assignments, or confusing topics. Here, you can study with clarity and confidence.

Here, learning is made simple. Notes are written in easy English, filled with clear theory, code examples, outputs, and real-life explanations — designed especially for students like you who want to understand, not just memorize.

Whether you’re from school, college, or someone learning out of curiosity — this site is for you. We’re here to help you in your exams, daily studies, and even to build a strong base for your future.

Each note on this platform is carefully prepared to suit all levels — beginner to advanced. You’ll find topics explained step by step, just like a good teacher would do in class. And the best part? You can study at your pace, anytime, anywhere.

Happy Learning! – Team ShikshaSanchar