Author Archive Slide Scope

BySlide Scope

Maths Module in Python Language

How to Import Maths Module in Python

Maths module is already included with python installation.

To import any module in your program you must use:

import <modulename>

To import Math module write:

>>>import math

Example

>>> print(pi)

NameError: name ‘pi’ is not defined

>>> import math

>>> print(math.pi)

3.141592653589793

>>> print(pi)

NameError: name ‘pi’ is not defined

We must use math. before calling any method or variable of math module.

>>> math.factorial(5) # To calculate factorial

120

>>> math.e

2.718281828459045

BySlide Scope

Typecasting in Python – Changing Data Types in Python

Typecasting in Python

It is the process of changing one datatype to another data type.

Functions used to do typecasting.

str(x) – To change x to string

int(x) – To change x to integer ( x must be float or bool but not complex or string)

float(x) – To change x to float ( x must be int or boolean)

complex(x) – To change x to complex number. ( x must be numeric or bool)

bool(x) – To change values to True or False ( 1 is true and 0 is False )

Here x is the variable which has to be typecasted.

>>>X = “15” # Here x is string

>>>type(X)

<class ‘str’>

>>> print(int(X))

15 # X is now integer

 

BySlide Scope

Taking User Input in Python Language

How to Take User Input in Python

We can take user input in python using the console window or we can also create GUI using python.

To create GUI windows in Python we use a library or module called Tkinter.

To take user input in python using console window we use and built in function called:

input()

Example:

name = input(“Enter Name”)

# Here name is the variable where we want to store of the value which user will enter in the console screen.

“Enter Name” is an instruction to user.

input() function creates string values only.

Example :

name = input(“Enter Name”)

pwd = input(“Enter Password”)

if(name==”Mohan”):

            print(“Welcome Mohan”)

if(pwd==”123″):

            print(“Your Password is correct”)

else:

            print(“You are not mohan”)

 

Exercise : Create a program in python to calculate the area of a triangle.

a=float(input(“enter a in cm”))

b=float(input(“enter b in cm”))

c=float(input(“enter c in cm”))

s=(a+b+c)/2

print(“area is ” ,(s*(s-a)*(s-b)*(s-c))**0.5, “cm^3”)

input()

BySlide Scope

Comparison Operators in Python Language

Comparison Operators

In programming comparison operators are used to compare two or more values. These are comparison operators used in Python.

  1. Equals To – “==”

To check whether one value is equal to other value.  The answer is returned in Boolean format.

Example:

>>> name = “Mohit”  # Assignment

>>> name == “Mohit”  # Comparison

True  # Output

>>> x = 5  # Assigment

>>> 5 == x  # Comparsion – LHS is equal to RHS here

True

 

*Use of If Condition

Syntax of if

if(condition):

            statement

Example

>>> name = “Ramesh”

>>> if(name == “Ramesh”):

#indentation block

print(“Welcome Ramesh Babu”)

Welcome Ramesh Babu  #output

  1. Greater than: “ > “

>>> x = 67

>>> if(x > 65):

            print(x, ” is greater than 65″)

67 is greater than 65

Example with With if and else :

x = 68

if(x > 65):

            print(x , ” is g t 65 “)

else:

            print(x , ” is ngt 65 “)

# 68 is g t 65

  1. Greater than or equal to

Example :

>>> t = 678   # assignment

>>> t >= 789 # comparison

False              # output

>>> t >= 678

True

>>> t >= 677

True

  1. Less Than

>>> cb = 56

>>> cb < 45

False

  1. Less than or equal to

>>> cb = 56

>>> cb <=  56

True

>>> cb <=  78

True

 

BySlide Scope

Assignment Operators in Python Language

Here are the Assignment Operators in Python Language

Assignment Operators are used to assign values to variables. In simple words, putting value in a variable. These values can be of any data type.

  1. Equal to Operator – ‘=’

Equal to operator is used to assign any value to a variable.

Example –

>>> x = 5

>>> name = ‘Mohit’

Here value of 5 (integer) is assigned to variable x

Value of  Mohit (String type) is assigned to variable name.

Note – the value to be assigned (defined) should be written on right hand side of = sign.

Here x = 5  is correct but 5 = x is incorrect.

See an example:

>>> a = 65

>>> b = a

>>> print(b)

65

>>> u = 65

>>> u = v #Will raise Error

  1. Assignment with addition

See Example

>>> x = 56

>>> x += 56

>>> print(x)

112

Here x + = 56 means x = x + 56

  1. Assignment with Subtraction

>>> g = 58

>>> g -= 8    #   g = g-8 | g = 58 – 8

>>> print(g)

50

We are assigning a value of g – 8 to g itself.

  1. Assignment with multiplication

>>> a = 4

>>> a *= 5   # a = a * 5

>>> print(a)

20

 

 

  1. Assignment with Division

>>> df = 45

>>> df /= 5   # df = df / 5

>>> print(df)

9.0

BySlide Scope

Arithmetic Operators in Python Language

Arithmetic Operators

  1. Addition – ‘+’ – To Sum two or more numbers

>>> x = 56

>>> y = 45

>>> x + y

101

  1. Subtraction – ‘-’ – To Subtract two or more numbers

>>> a = 345

>>> b = 123

>>> a – b

222

  1. Multiplication – ‘*’ – To find the product of two or more numbers

>>> u = 45

>>> v = 3

>>> u * v

135

>>> a * b * u

1909575

  1. Division – ‘/’ – To divide two or more numbers. Answer is always a float.

 >>> people = 6

>>> quantity = 42

>>> quantity / people

7.0

  1. Exponentiation – ‘**’ – To find y raised to power of x or vice versa.

>>> x = 5

>>> y = 2

>>> y ** x

32

>>> x ** y

25

  1. Modulus – ‘%’ – To find the remainder in any division.

>>> x = 22

>>> y = 7

>>> x / y

3.142857142857143

>>> x % y  # Finding the remainder

1

>>> 343 % 4

3

  1. To Find Quotient in Division – ‘//’

>>> 343 / 4 # Division

85.75

>>> 343 % 4 # Remainder

3

>>> 343 // 4 # Quotient

85

BySlide Scope

Operators in Python Language

Operators in Python language

Operators are used to perform specific actions in programming languages.  Here are names of some common operator in Python:

  1. Arithmetic Operators ( Also known as math operators )
  2. Assignment Operators ( To assign values to variables )
  3. Comparison Operators ( To compare value of two or more variables )
  4. Logical Operators ( To combine multiple operations logically )

 

BySlide Scope

Variables in Python – Tutorial

Variables are used to store values in Python. These variables can be used later on in the program for computing purpose.

Variables have a name, value and a memory location in computer.

For Example:

X = 56

Here X is the Variable Name and 56 is its value.

= is known as assignment operator.

The meaning of this statement is – A value 56 of integer datatype has been assigned to a variable named X.

Another Example :

>>> name = “Rohit”

Here variable name is name

Here value of variable is “Rohit” 

>>> type(name)

<class – str>

How to Print a Variable

>>> print(name)

Output : Rohit

We can use variables to perform mathematical operations.

>>> x = 56

>>> y = 67

>>> print(x + y)

Output : 123

Variable values can also be changed.

>>> name = “Mohan”

>>> print(name)

Mohan

>>> name = “Sohan” # We have changed the previously assigned value.

>>> print(name)

Sohan

You can call variables – value-holder.

These values can be of any datatype.

>>> # Valid Variable Names

>>> first_name = “Mohan”

>>> FirstName = “Mohan”

>>> Firstname = “Mohan”

>>> firstName = “Mohan”

>>> # Invalid Variable Names

>>> first name = “Mohan” # using spaces is not allowed in variable names

SyntaxError: invalid syntax

>>> first-name = “Mohan” # using – sign means subtraction so it is not allowed

# No symbol is allowed except _ (underscore)

>>> We cannot start a variable name with number

>>> 1name = “Mohan” # invalid

>>> name1 = “Mohan” # valid

 

BySlide Scope

Tableau Course

Tableau Training in Lucknow

Tableau training is done by students and working professionals of Data Science industry.

Tableau is an easy to use tool to analyze data written in structured formats like JSON, Excel, CSV, XML, SQL etc.

Tableau is used to create interactive dashboards to visualize data in graphical and tabular form.

[email protected]

Benefits of Tableau Course

1. Tableau is a simple and easy to learn software tool for data analytics.

2. If you are new to coding or you dont know coding at all, you can start working on Tableau immediately.

3. Tableau helps in quick, creative and interactive databases.

4. Tableau can handle large datasets easily.

5. Tableau does the work of detecting the datatype in spreadsheets automatically. Datatypes like Strings, Numeric Values, Geographical Values etc. can be easily visualized using Tableau.

 

 

 

BySlide Scope

Points to keep in mind while choosing a domain name | SEO Basics | Slidescope

Points to keep in mind while choosing a domain name

Domain name is the most important part of every website. Whether it’s about branding your business or making a mark in the digital world. It is the first thing that makes your mark in your digital marketing world. It is advisable to go through proper research and alterations before choosing the domain name. Here are few things to keep in mind before choosing a domain name.

Search Engine Optimization

One of the norms of Google for getting better result in SERP (Search engine result page) is to have your focused keyword in your domain.

For e.g.

If you are providing marketing services you can go for

www.marketingbrand.com

And for any specific location

www.marketinginlucknow.com

Easy to remember

Domain name should be easy to remember and should be such that it positioned itself in the buying persona of consumer. This means that the spelling of the domain should be clear simple and short. Avoid using slangs for the domain.

e.g.  Marketingforyou.com is much more meaningful than marketing4you or marketingforu or marketing4u.

Meaningful Domain

Domain name should be meaningful that means it should represent your business in complete or specific manner.

e.g. : Airtel the word itself comprises of two words Air and Tel (telecommunication) which clearly explains the business of Airtel company.

Avoid using hyphen in the domain name

Avoid using hyphen in domain as when we tell our website url to someone we only speak the words of the domain rather than mentioning the hyphen in the url.

e.g. : digitalmarketinginlucknow and marketing-in-lucknow both have same pronunciation.

Use only top level domain for business

.com for commerce

.net for technical

.in for specific to Indian region

.edu and .ac.in for educational purpose, etc for their specific purpose related to your business.

 

Review the Domain name plan

While choosing a domain name plan go thru the terms and conditions, pricing thoroughly. Check all the documentation and nameservers for ease in installation.

Finding the same name as Username in Social Media Marketing is also very important.