Tumgik
msohaibwaqas · 2 years
Text
Line Plot and Bar Plot in python
Line Plot and Bar Plot in python
Line and Bar Plots¶ Import Libraries¶ Seaborn automatically install these libraries in jupyter notebook numpy scipy pandas matplotlib In [1]: # import libraries import seaborn as sns import matplotlib.pyplot as plt #load built-in dataset flower = sns.load_dataset("iris") flower # it will show data present in dataset named…
View On WordPress
0 notes
msohaibwaqas · 2 years
Text
Graphs and Data Sets in Python
Graphs and Data Sets in Python
Graph show in python¶ Categorical variables¶ BarPlots¶ In [1]: import seaborn as sns import matplotlib.pyplot as plt sns.set_theme(style="ticks",color_codes=True) titanic = sns.load_dataset("titanic") #it will load built-in data from seaborn library stored as titanic. sns.catplot(x="sex", y="survived", hue="class", kind="bar", data=titanic) plt.show() Count Plots¶ In [2]: import seaborn as…
View On WordPress
0 notes
msohaibwaqas · 2 years
Text
Indexing of strings and methods
Indexing of strings and methods
Indexing of Strings in Python¶ In [1]: #make a string a = "Samosa Pakora" a Out[1]: 'Samosa Pakora' In [2]: a[0] Out[2]: 'S' In [3]: a[1] Out[3]: 'a' In [4]: a[11] Out[4]: 'r' In [5]: # index of length len(a) Out[5]: 13 In [6]: a[0:6] Out[6]: 'Samosa' In [7]: a[0:5] #last index is…
View On WordPress
0 notes
msohaibwaqas · 2 years
Text
Data structures in python
Data structures in python
Basic Data Structures in Python¶ 01-Tuples in python¶ Ordered Collection of elements enclosed in () Different type of elements can be stored once elements are stored you cannot change them In [2]: tup1 = (1, "python", True, 2.5) tup1 Out[2]: (1, 'python', True, 2.5) In [3]: type(tup1) Out[3]: tuple Indexing in…
View On WordPress
0 notes
msohaibwaqas · 2 years
Text
Libraries and their use in python
Libraries and their use in python
Import Libraries in Python In [1]: import math print ("The value of Pi is =" ,math.pi) The value of Pi is = 3.141592653589793 In [2]: import statistics a = [15, 56, 57, 525, 45, 48] print(statistics.mean(a)) 124.33333333333333 numpy, pandas, seaborn are widely used libraries for data science in python
View On WordPress
0 notes
msohaibwaqas · 2 years
Text
Loops syntax in python
Loops syntax in python
Loops in Python While loop in python In [1]: a = input("Enter a positive number less than 10") a = int(a) while (a<=10): print(a) a=a+1 #a++ is invalid in python Enter a positive number less than 105 5 6 7 8 9 10 For loop in python In [2]: a = input("Enter a positive number less than 10 \n") a = int(a) for a in range(a,10): # it will run in renge of given arguments print(a) Enter a…
View On WordPress
0 notes
msohaibwaqas · 2 years
Text
User Defined Functions in python
User Defined Functions in python
User Defined Functions if Python Defining a function In [1]: #1 def csd(): # Function decleration and defination print("Welcome to python course") print("Welcome to python course") print("Welcome to python course") csd() # Function call Welcome to python course Welcome to python course Welcome to python course In [2]: #2 def csd(): text="Welcome to python…
View On WordPress
0 notes
msohaibwaqas · 2 years
Text
Conditional statements available in python
Conditional statements available in python
Conditional Statements in python if Statement In [1]: a = input("Enter First value\n") b = input("Enter Second value\n") if a >= b: print(a, "is greater than", b) if b>=a: print(b, "is greater than", a) Enter First value 5 Enter Second value 6 6 is greater than 5 if-else Statement In [2]: a = input("Enter First value\n") b = input("Enter Second value\n") if a >= b: print(a, "is greater…
View On WordPress
0 notes
msohaibwaqas · 2 years
Text
Data types available in python
Data types available in python
Data types and Conversions Data Types available in python In [1]: x = 5 y = 1.5 z = "hello" print (x) print(type(x)) print (y) print(type(y)) print (z) print(type(z)) 5 <class 'int'> 1.5 <class 'float'> hello <class 'str'> Conversion of data types Implicit type conversion In [2]: # x at this point is integer. x=x+y # x at this point is float print(x,"\nType of x is:", type(x)) 6.5 Type…
View On WordPress
0 notes
msohaibwaqas · 2 years
Text
Conditional operators available in Python
Conditional operators available in Python
Logical Operators In [1]: # logical operators are either "True or False" or "Yes or No" or "0 or 1" # equal to == # not equal to != # less than < # less than and equal to <= # greater than > # greater than and equal to >= print(4==4) print(7!=7) print(3<7) print(4<=8) print(7>5) print(9>=8) True False True True True True In [2]: # application of logical operators age = 4 school =…
View On WordPress
0 notes
msohaibwaqas · 2 years
Text
Input Function in Python
Input Function in Python
In [1]: x = "hello" print (x) hello In [2]: # input function y = input("What is your message? ") print (y) What is your message? Hello Hello In [3]: # second stage of input function name = input("What is your name? ") greetings = "Hello" print (greetings , name) What is your name? Sohaib Hello Sohaib In [4]: # another method of second stage input function name = input("What is your…
View On WordPress
1 note · View note
msohaibwaqas · 2 years
Text
Variable Name and their types in python
Variable Name and their types in python
By default a variable’s data type is string unless we assign a value to it during declaration. If we declare a variable and take value from user then it will be treated as string variable. So we have to change its data type and then take value from user. In [1]: # types of variables x = 5 y = 1.5 z = "hello" print (x) print(type(x)) print (y) print(type(y)) print (z) print(type(z)) 5 <class…
View On WordPress
0 notes
msohaibwaqas · 2 years
Text
Operators Available in python and their use.
Operators Available in python and their use.
In [1]: #Addation Operator in Python print(2+7) 9 In [2]: #Subtraction Operator in Python print (8-6) 2 In [3]: #Multiplication Operator in Python print(3*4) 12 In [4]: #Division Operator in Python print (78/6) 13.0 In [7]: #Integer Division Operator in Python print(78//6) 13 In [6]: #Remainder Operator in Python print(78%4) 2 In [9]: #Exponent Operator in…
View On WordPress
0 notes
msohaibwaqas · 2 years
Text
Strings in python
In [1]: #Strings print in python # We can print strings using single(''), double("") and triple('''''') print('Hello world') print("Hello World") print('''Hello World''') print("What's up") # Strings clear #to comment multiple lines, select those lines and press ctrl+/ Hello world Hello World Hello World What's up
View On WordPress
0 notes
msohaibwaqas · 2 years
Text
How do we get output in Python
How do we get output in Python
# How to get Output in python print (5+7) print("Hello World") print("Let's learn python") 12 Hello World Let's learn python
View On WordPress
0 notes
msohaibwaqas · 2 years
Text
Output Function in Python
Output Function in Python
01_outputhttps://cdnjs.cloudflare.com/ajax/libs/require.js/2.1.10/require.min.js pre { line-height: 125%; } td.linenos .normal { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; } span.linenos { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; } td.linenos .special { color: #000000; background-color: #ffffc0; padding-left:…
View On WordPress
0 notes
msohaibwaqas · 6 years
Text
ASP code to open a database
ASP code to open a database
Question Number 6: Write ASP code to open a database “student”. When a user enters student’s code in a search box and clicks the search button. It searches record in a table “address (code, name, age, city)”. If the record found, display a message “Record Found” and display the record of that student. Otherwise display the message “Record not found”. To get details of this HTML section problem…
View On WordPress
0 notes