Written by students who passed Immediately available after payment Read online or as PDF Wrong document? Swap it for free 4.6 TrustPilot
logo-home
Class notes

Variables and Lists in Python ( Index, Input )

Rating
-
Sold
-
Pages
1
Uploaded on
12-05-2026
Written in
2025/2026

Provides colloquial easy definitions and explanation for variables, lists in python with index and input functions used.

Institution
Course

Content preview

PYTHON NOTES JEGAN K K
VARIABLE:
A variable in python can hold data of any data type (i.e. numeric / string / instances , etc).
Example:
a=3
b = 'pen'
v = Vector()
Declaring multiple variables in a single line requires map() function for scenarios where the
input is dynamically received from the user
Example: a, b = map (int, input().split())
Map() function used above, maps 2 integer values as input from the user, then assigns it to a, b
respectively.
We can also declare a variable with one value and multiple values on the same operation like
below,
a, *b = map (list, input().split())
Here '*' is used to assign series of remaining values to b.


LISTS:
In python, list is a collection of values of either same data type or different data types. List can
also be a collection of instances, lists, tuples, dictionaries, sets, etc.
To Declare an empty list [ ] (square brackets) are used ➔ a = [ ]
To receive dynamic input from user ➔ a = list (map(int, input().split()))
split() during input function, is used to split the input based on specified space value or the
whitespace on default.


INDEX:
To find an index of the value ➔ list-name . index (val)
The value is to be mentioned inside the curvy braces which inturn returns the index of that
mentioned value in the list.
Note: LIST index always starts from 0.

Written for

Course

Document information

Uploaded on
May 12, 2026
Number of pages
1
Written in
2025/2026
Type
Class notes
Professor(s)
Jegan k k
Contains
Variables and lists ( input, index )

Subjects

$3.49
Get access to the full document:

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Get to know the seller
Seller avatar
jegan

Get to know the seller

Seller avatar
jegan Self Employed
Follow You need to be logged in order to follow users or courses
Sold
-
Member since
1 month
Number of followers
0
Documents
6
Last sold
-

0.0

0 reviews

5
0
4
0
3
0
2
0
1
0

Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions