Loading...
More Python Posts
import pandas as pdx = pd.read_excel(FILE_NAME)print(x)
# function which return reverse of a stringdef isPalindrome(s):return s == s[::-1]# Driver codes = "malayalam"ans = isPalindrome(s)if ans:print("Yes")else:print("No")
from math import pidef rads_to_degrees(rad):return (rad * 180.0) / pirads_to_degrees(pi / 2) # 90.0
class Solution(object):def floodFill(self, image, sr, sc, newColor):R, C = len(image), len(image[0])color = image[sr][sc]if color == newColor: return imagedef dfs(r, c):if image[r][c] == color:image[r][c] = newColorif r >= 1: dfs(r-1, c)if r+1 < R: dfs(r+1, c)if c >= 1: dfs(r, c-1)if c+1 < C: dfs(r, c+1)dfs(sr, sc)return image
# Python Program to calculate the square rootnum = float(input('Enter a number: '))num_sqrt = num ** 0.5print('The square root of %0.3f is %0.3f'%(num ,num_sqrt))
# Listlst = [1, 2, 3, 'Alice', 'Alice']# One-Linerindices = [i for i in range(len(lst)) if lst[i]=='Alice']# Resultprint(indices)# [3, 4]