This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import math | |
def rotate(origin, point, angle): | |
# source: https://stackoverflow.com/a/34374437 | |
ox, oy = origin | |
px, py = point | |
qx = ox + math.cos(angle) * (px - ox) - math.sin(angle) * (py - oy) | |
qy = oy + math.sin(angle) * (px - ox) + math.cos(angle) * (py - oy) | |
return int(round(qx)), int(round(qy)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
a=magic(4); | |
fprintf('The original matrix is:\n'); | |
disp(a); | |
b=a.'; | |
fprintf('\n'); | |
fprintf('The transposed matrix is :\n'); | |
disp(b) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import random | |
capitals = {'Alabama': 'Montgomery', 'Alaska': 'Juneau', 'Arizona': 'Phoenix', | |
'Arkansas': 'Little Rock', 'California': 'Sacramento', 'Colorado': 'Denver', | |
'Connecticut': 'Hartford', 'Delaware': 'Dover', 'Florida': 'Tallahassee', | |
'Georgia': 'Atlanta', 'Hawaii': 'Honolulu', 'Idaho': 'Boise', 'Illinois': | |
'Springfield', 'Indiana': 'Indianapolis', 'Iowa': 'Des Moines', 'Kansas': | |
'Topeka', 'Kentucky': 'Frankfort', 'Louisiana': 'Baton Rouge', 'Maine': | |
'Augusta', 'Maryland': 'Annapolis', 'Massachusetts': 'Boston', 'Michigan': | |
'Lansing', 'Minnesota': 'Saint Paul', 'Mississippi': 'Jackson', 'Missouri': |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!usr/bin/python3 | |
import re | |
file=open('mad.txt') | |
text=file.read() | |
file.close() | |
regex=re.compile(r'(NOUN) | (ADJECTIVE) | (VERB)') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import shutil,os | |
def selectiveCopy(folder,extensions,destFolder): | |
folder=os.path.abspath(folder) | |
print(folder) | |
destFolder=os.path.abspath(destFolder) | |
print(destFolder) | |
print('Looking in '+ folder+ ' for files with extensions of ', ','.join(extensions)) | |
for foldername,subfolders,filenames in os.walk(folder): | |
print("***",foldername, "**", subfolders , "*",filenames) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<stdlib.h> | |
#include<stdio.h> | |
int main(){ | |
int n; | |
int *arr; | |
printf("\nEnter the number of elements in the array:" ); | |
scanf("%d",&n); | |
arr=(int*)malloc(n*sizeof(n)); | |
if (arr==NULL){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<stdio.h> | |
#include<stdlib.h> | |
int main(){ | |
int **arr; | |
int rows,cols; | |
printf("\nEnter the number of rows and columns respectively:" ); | |
scanf("%d %d",&rows,&cols ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
n=int(input()) | |
arr=list(map(int,input().split()))[:n] | |
arr.sort | |
q=int(input()) | |
ques=[input().split() for i in range(q)] | |
for que in ques: | |
count=0 | |
if que[0]=='0': |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<link rel="shortcut icon" href="{{ url_for('static', filename='images/favicon.ico') }}"> | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<head> | |
<meta http-equiv="content-type" content="text/html; charset=UTF-8" /> | |
<script> | |
L_NO_TOUCH = false; | |
L_DISABLE_3D = false; | |
</script> | |
<style>html, body {width: 100%;height: 100%;margin: 0;padding: 0;}</style> |