Skip to main content

PYTHON SHORT NOTES


VARIABLES & STRINGS:

Variables are used to store values. A string is a series of characters, surrounded by single or double quotes.
Hello world
print("Hello world!")
Hello world with a variable
msg = "Hello world!" print(msg)
Concatenation (combining strings)
first_name = 'albert' last_name = 'einstein'
full_name = first_name + ' ' + last_name print(full_name)

LISTS:

A list stores a series of items in a particular order. You access items using an index, or within a loop.
Make a list
bikes = ['trek', 'redline', 'giant']
  Get the first item in a list                                             
first_bike = bikes[0]
Get the last item in a list
last_bike = bikes[-1]
Looping through a list
for bike in bikes: print(bike)
Adding items to a list
bikes = [] bikes.append('trek') bikes.append('redline') bikes.append('giant')
Making numerical lists
squares = []
for x in range(1, 11): squares.append(x**2)

Comments

Popular posts from this blog

Industry Ethics and Legal Issues MCQ Questions With Answer

ETHICS ALL POSSIBLE QUESTION - SET 1 Q1. Before 16 Jan, How many states were already working in Startup India policies? a) 1 b) 3 c) 4 d) 7 Q2. Which of the following is not a part of Funding Innovation? a) Incubation Center b) Startup Yatra Funds c) Research Parks d) Manak Q3. For R& D, human resource started a new scheme for students a) Tinkering labs b) Manak c) Avishkar yojana d) Uchhatar Avishkar yojana Q4. Startup India Scheme? 1. Age should not be more than 3 years 2. Should develop innovative product. 3. Must be Private Limited Company/ Registered Partnership firm/ Limited Liability Partnership 4. Has patent granted in areas affiliated with the nature of business being promoted a) 1, 3 6) 1,2 and3 c) 2, 3 and 4 d) All of the above Q5. The period of business when an entrepreneur must position the venture in a market and make necessary adjustments to assure survival is called the: a) pre-Startup stage b) Startup singe ...

DIGITAL MARKETING

DIGITAL MARKETING END TERM PRACTICAL PAPERS:

WEB DEVELOPMENT COURSE

CLICK ON LINK AND ENJOY THE COURSE.  LINK : BUILDING YOUR FIRST WEBSITE IN HTML