# 1 What’s Pickling and Unpickling?
- Pickling – the process of a Python object hierarchy being converted into a byte stream
- Unpickling – is the inverse operation, where a byte stream is converted back into an object hierarchy.
Pickling is also called serialization, marshalling, or flattening.
# 2 What Is the Difference Between range() and xrange() Functions in Python?
- range() – range returns a Python list object. Range keeps the entire list of numbers in memory.
- xrange() – returns an iterator and only keeps one number in memory at a time.
# 3 How to create a random number?
Use the random module. This module is used to generate random numbers.
# Import random
import random
# 4 How would you make a string all Upper Case?
var='codeit'
print(var.upper())
# 5 What is split used for?
split() method is used to separate a given string.
var="code it blog "
print(var.split())
# 6 How can files be deleted in Python?
import the OS Module to delete a file.
import os
os.remove("File_Name.txt")
# 7 How do you calculate percentiles ?
import the module Numpy
import numpy as np
varArray = np.array([1,2,3,4,5,6,7,8,9,10])
p = np.percentile(varArray, 75) #Returns 75th percentile
print(p)
# 8 What is unittest in Python ?
Python unittest module is used to test a unit of source code.
# 9 What is a dictionary in Python and how do you create one?
Dictionaries are used to store data values in key:value pairs
my_dict = {'Pet':'Dog', 'Size': 'Small'}
print(my_dict)
# 10 How many basic types of functions are available in Python?
Python has two types of functions.
1. Built-in
2. User-defined
Some Built-in functions include print(), len(),set() and int()
Android Studio Loading Animation Between Activities
Progress Dialog is dialog showing a progress indicator and an optional text message or view. The methods of Progress Dialog being used in this tutorial are: ProgressDialog.setTitle() – Used to set title of dialog box ProgressDialog.setMessage() – Used to set dialog message being displayed ProgressDialog.setProgressStyle() – Choose the style of indicator ProgressDialog.dismiss() – Dismiss the…
Android Studio Tutorial SeekBar
SeekBar is an extension of ProgressBar that adds a draggable thumb. The user can touch thumb and drag left or right to set the current progress level or various other task. In this example, the seekbar will be used to display a percentage. As the user moves the SeekBar left to right the percentage value…
Python Ethereum Block Chain Interaction with Web3
This tutorial will show how to interact with the Ethereum blockchain using Python. To start, the Python library Web3 will need to be installed. The Web3 library allows you to interact with a local or remote Ethereum node, using a HTTP or IPC connection. Using Web3 you will be able to create smart contracts on…