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