codewithronny logo
codewithronny logo
  • Category
    • Adsense
    • Blog
    • Boilerplate
    • CodeWithRonny
    • Course Review
    • How to
    • HTML Tutorial
    • JavaScript
      • JavaScript Tutorial
    • Laravel
    • Machine Learning
      • Machine Learning Tutorial
    • MySQL
      • MySQL Tutorial
    • Networking
    • PHP Tutorial
    • Python
      • Data Structure Using Python
      • Python Interview Question
      • Python Tutorial
    • Python Coding Interview Practice
    • Server
      • Share Hosting
    • Tech Celebrity
    • Web Technologies and Development
    • Wordpress
      • Theme
  • Information
    • Contact Us
    • About Us
    • Privacy Policy
    • Terms
    • Disclaimer
  • Code Editor
    • HTML Code Editor
    • Python Code Editor
Python Tutorial
Python TutorialPython VariablesVariables Name in PythonPython Variables - Multiple Value AssignmentPython Data Types

Python – Output Variables


In Python, the print() function is used to display output to the screen. You can use it to print text, variables, or any other information you want to see while running your program.

Here’s a simple example:

print("Hello, World!")

You can also print variables:

output = "Hello, World!"
print(output)

print() function is capable to print multiple variables at one time.

variable1 = "We "
variable2 = "are "
variable3 = "Python Lover"

print(variable1, variable2, variable3)

Notice the space characters after “we ” and “are “, without space character the result would be “WearePython Lover

For numbers + operator are uses for mathematical operator

variable1 = 5
variable2 = 6

print(variable1 + variable2)

Python will give you an error when try to combine String and Number with + operator

variable1 = 5
variable2 = "Apple"

print(variable1 + variable2)

The Best way to combine and string and integer is seperate it with comma ( , ) :

variable1 = 5
variable2 = "Apple"

print(variable1, variable2)

To combine a string and an integer in the print() function in Python, you can use the str() function to convert the integer to a string, and then concatenate it with the string using the + operator. Here’s an example:

my_string = "The value is "
my_integer = 42

print(my_string + str(my_integer))






codewithronny logo
codewithronny logo

A Tutorial Cafe

  • Twitter
  • Facebook
  • Instagram
  • Linkedin
  • Linkedin
Company
    About Us
  • Contact Us
  • Career
Community
    Documentation
  • Faq
  • Sitemap
Explore
    Terms & Conditions
  • Privacy policy
  • Disclaimer
  • Affiliate Disclosure
  • Become an Author
  • How to guide
Contact


Copyrights ©2024 CodeWithRonny
  • GlobeLanguage Chevron
    • English
    • Hindi
  • Terms of use
  • Cookies
  • Sitemap