Skip to main content

One min read

Code >

file.py
import pandas as pd
data = [['Python','Basics',5], ['Python', 'OOPs',6], ['Python','Exception Handling',2] ,
['Python', 'Database',4],
['Python', 'REgular Expressions',3],
['Python', 'Data Analysis',6] ]
df = pd.DataFrame(data, columns = ['Category', 'Name','No of lecture'])
print(df )

Output >

Output
Category              Name            No of lecture
Python Basics 5
Python OOPs 6
Python Exception Handling 2
Python Database 4
Python REgular Expressions 3
Python Data Analysis 6

One min read

Code >

file.vb
import pandas as pd
data = [{'401': 'Python', '402': 'ISSA', '403': 'OT','404':'EAF','405':'KRAI'},
{'401':'Programming','402':'Security','403':'Maths','404':'Architecture','405':'AI'}]
dbs= pd.DataFrame(data, index =['subject','Description'])
print (dbs, "\n")

Output>

Output
 401 402 403 404 405
subject Python ISSA OT EAF KRAI
Description Programming Security Maths Architecture AI

One min read

Code >

file.vb
import numpy as np
a = np.ones(3, dtype = int)
print("Matrix a:", a)
b = np.ones([4, 4], dtype = int)
print("Matrix b:", b)

Output >

Output
import numpy as np
a = np.ones(3, dtype = int)
print("Matrix a:", a)
b = np.ones([4, 4], dtype = int)
print("Matrix b:", b)

One min read

Code >

file.py
import numpy as np
arr = [[114, 117, 19, 33, 44],
[15, 6, 27, 8, 19],
[23, 2, 54, 1, 24,]]
print("Sum of array : ", np.sum(arr))
print("Sum of arr(float32) : ", np.sum(arr, dtype = np.float32))

Output >

Output
Sum of array :  506
Sum of arr(float32) : 506.0

One min read

Code >

file.py
import numpy as np
import pandas as pd
matrix = [(100, 63, 47),
(11, 103, 117),
(49, 36, 55),
(75,24, 34),
(89, 21, 44)
]
panda_max = pd.DataFrame(matrix, index = list('symca'), columns = list('psk'))
maxValues = panda_max.max()
print(maxValues)

Output >

Output
100
103
117

One min read

You are given a Juice class, which has name and capacity properties. You need to complete the code to enable and adding of two Juice objects, resulting in a new Juice object with the combined capacity and names of the two juices being added.

For example, if you add an Orange juice with 1.0 capacity and an Apple juice with 2.5 capacity, the resulting juice should have: name: Orange&Apple capacity: 3.5

The names have been combined using an & symbol.

Use the a** method to define a custom behavior for the + operator and return the resulting object.

Program Answer >

file.py
class Juice:
def __init__(self, name, capacity):
self.name = name
self.capacity = capacity
def __add__(self, other):
return self.name + "&" + other.name + " (" + str(self.capacity + other.capacity) + "L)"
a = Juice('Orange', 1.5)
b = Juice('Apple', 2.0)
result = a + b
print(result)
Output
Input
No Input
Your Output
Orange&Apple (3.5L)
Expected Output
Orange&Apple (3.5L)

2 min read

In this tutorial we will see Making Free Medium Blog,

First visit medium.com,

& if you don't have a medium account, Create an account, Once the account is created login into your account, Once you are logged in to your medium account click on the profile picture in the top right and select the Write Story option. Making Free Medium Blog

Once you click on write story you will see option to write post, In Story title add title for your blog post & below write content you can also import images, videos etc easily.

See Screenshot below Making Free Medium Blog

After writing story click on Publish button in top right corner, Medium will ask for more post details, Let's see

Story Preview : In story preview you have to put featured image for your story, it will be shown in top of your post and also show as thumbnail when you share post on social media paltforms.

Making Free Medium Blog

Once your story is published you will get a confirmation dialog box about that your story is published,

If this was your first post medium will ask you to complete your profile, Making Free Medium Blog

You will be asked to provide full name, your bio and profile photo, add those details, if don't want to add now just click on continue. ( you can always change these setting later)

Now in next step we can claim url Making Free Medium Blog

You can claim as you want, after that click on claim URL, Make sure that once you claim URL, do not change URL, that will affect your site ranking

That's it , done, Keep in mind You can not run ads here, they have there own partner program please read about it in profile section.

If you want to read more about Advantages and disadvantages of medium you can read here

One min read
  • First thread to print the square of a number entered by user,
  • Second thread to print the cube of a number and show the result. Use start and join operations.
file.py
from _thread import *
import threading as thread
def sqr(name,num):
print(name+" : ",num*num)
def cube(name,num):
print(name+" : ",num*num*num)
try:
no=int(input("enter number : "))
thread.start_new_thread( sqr, ("\nThread - 1: Square:", no ) )
thread.start_new_thread( cube, ("\nThread - 2: Cube :", no ) )
#join()
numTuple = ['1', '2', '3', '4']
print("#".join(numTuple))
except Exception as e:
print ("Error: ",e)
Output
enter number : 9
1#2#3#4
Thread - 1: Square: : 81
Thread - 2: Cube : : 729