0% found this document useful (0 votes)
7 views

Print Input Comments Variables Indentation

The document discusses Python comments, printing, string manipulation, user input, variables, and the len() function. It shows how to add comments in Python, print strings with newlines and concatenation, take input from the user, assign variables and reassign new values, and get the length of a variable's value.

Uploaded by

himanacademy777
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views

Print Input Comments Variables Indentation

The document discusses Python comments, printing, string manipulation, user input, variables, and the len() function. It shows how to add comments in Python, print strings with newlines and concatenation, take input from the user, assign variables and reassign new values, and get the length of a variable's value.

Uploaded by

himanacademy777
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

# Comments

# Single List comments starts with # before beginning of the line


and the line won't get executed

# for a line to be commented select the line and press ctrl + /

# Printing
print("Hello World!")

print("What we need to print")

# String Manipulation
# 1) \n for new line

print("Hello World \n Hello World \n Hello World \n Hello World")

# 2) Adding (or) Concate two Strings

print("Hello" + "Name")

# 3) For Spaces

print("Hello " + "Name")

print("Hello" + " Name")

print("Hello" + " " + "Name")

# Indentation
print("")

# print("") # Gives Error if we uncomment this

# Taking Data from User

input("Your Question to ask for getting answer from user")

# After receiving the data from the user the function replaced with
data from user

print("Hello " + input("What is your Name"))

# Variables
# 1) Used to store data in them and they are mutable (Data can be
re-assigned to it) and any type of data

name = "Kadapa"

print(name)

name = "Hello"

print(name)

name = 123

print(name)

# 2) It can store data received from the input() function

name = "What is your Name ?"

print(name)

# 3) len() function is used to get length of the data present in the


variable

length = len(name)

print(length)

You might also like