Detailed Print – CSKC
Sign In

Search

siteicon
Code Learning#PYTHON#9996 Back

First Python Program: Modified “Hello, World!”

You have traditionally seen printing of “Hello World!” string as the first program in many languages. Some more tricks are here in your first program itself.

Source Code

		 

Click to open popup

Run Output

Hello World!
Hello World!
Hello
World!
HelloWorld!
Hello
World

Notes

  • The + sign can be used in string for concatenation (side by side addition)
  • The semicolon (;) character as line terminator is usable in python, but it is highly discouraged.
  • The print() function in python gives the newline automatically. For this reason the \n symbol may not be found so frequently in python. Still, it is a valid escape sequence within strings.


Suggested Filename(s): modif-hello-world.py, hello.py