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

"+" Makes Concatenation of Two Strings.: List and Tuples

The document discusses various Python concepts including: 1. When typing in the interpreter, variables can be directly printed without using print(). 2. Variables concatenated together on the interpreter are treated as strings due to string concatenation. 3. Python number types include floats for decimals and integers for whole numbers. The round() function rounds numbers to a specified decimal place. 4. Lists are mutable arrays that can contain numbers, strings or lists while tuples are similar but immutable containers. Strings are also immutable.

Uploaded by

tejasi
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)
38 views2 pages

"+" Makes Concatenation of Two Strings.: List and Tuples

The document discusses various Python concepts including: 1. When typing in the interpreter, variables can be directly printed without using print(). 2. Variables concatenated together on the interpreter are treated as strings due to string concatenation. 3. Python number types include floats for decimals and integers for whole numbers. The round() function rounds numbers to a specified decimal place. 4. Lists are mutable arrays that can contain numbers, strings or lists while tuples are similar but immutable containers. Strings are also immutable.

Uploaded by

tejasi
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
You are on page 1/ 2

While we type in interpreter , if we want to print some variable - directly mention the variable name.

no
need to write the "print()" function.

Every time we enter any thing on interpreter it is taken as a string / text. Hence if we are trying to add
variables on interpreter directly it will give a concatenation of the two variables. Bcoz in case of strings
“+” makes concatenation of two strings.

Types of numbers in python –

1. Floats – numbers with decimals


2. Integers – numbers without decimals

round() – to round off the number – syntax – ( var , x)

x : decimal places to which rounding is required.

List and Tuples-


List is an array of numbers, strings or lists

Tuples are similar to list but they are immutable.

Strings too are immutable.

Functions-

Defining a function – eg :

def function01(): <- function definition

….

….

function01() <- calling the function

Inside the parenthesis arguments are passed.

Passing default value in parameters –


Eg:

Def func(person1 , person2 = “the director”):

Func(“george”)

In this example if we do no pass second parameter, the default value will be printed.

Importing a module – with another name

If name of a module is too long we can import it using some other name like-

Import time as t

You might also like