0% found this document useful (0 votes)
1 views2 pages

Introo

Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
1 views2 pages

Introo

Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Lists in python:

 They are just like arrays.


 They are not homogeneous i.e they need not be of same type.
 A single list can contain, integers, strings as well as objects.
 They can be altered(changed) once declared.
Eg: list=["vid","gau",33,14]
print(list)
[Link](3)
print(list[1])

Tuples in python:
 They are just like lists but they are immutable i.e changes in tuples
are not possible once declared.
 Decared in round brackets.
Eg: tup=("vid",23,"sara")
print(tup)
print(tup[1])
Input and Output in Python
The print() function is used for output in various formats and the input()
function enables interaction with users.

Taking Input using input()


Python's input() function is used to take user input. By default, it returns
the user input in form of a string.
Eg: name = input("Enter your name: ")
print(“Hello my name is",name)

Printing Variables
We can use the print() function to print single and multiple variables.
We can print multiple variables by separating them with commas.
print(s)
Eg: s = "Anjelina"
age = 25
city = "New York"
print(s, age, city)

We can also take multiple inputs at once from the user in a single line,
splitting the values entered by the user into separate variables for each
value using the split() method:
Eg: x, y = input("Enter two numbers: ").split()
print(x , y)

You might also like