Skip to content

Instantly share code, notes, and snippets.

View Ra1d7's full-sized avatar
🛌
Focusing

Moath Altarawneh Ra1d7

🛌
Focusing
View GitHub Profile
@Ra1d7
Ra1d7 / UsingChars.py
Last active January 31, 2017 16:12
my first ever program in python (learning)
print("##########################################################")
print("\n Welcome to my file text encrypter/decrypter!")
print("Made using python ;)")
print("Usage: type encrypt to encrypt a file with providing a seed")
print("Usage: type decrypt to decrypt a file\'s contents if you have the correct seed")
print("##########################################################\n")
chars = {1: 'a', 2: 'b', 3: 'c', 4: 'd', 5: 'e', 6: 'f', 7: 'g', 8: 'h', 9: 'i', 10: 'j', 11: 'k', 12: 'l', 13: 'm',
14: 'n', 15: 'o', 16: 'p', 17: 'q', 18: 'r', 19: 's', 20: 't', 21: 'u', 22: 'v', 23: 'w', 24: 'x', 25: 'y',
26: 'z',27: '',28: " ", 29: 0, 30: 1, 31: 2,32: 3,33: 4,34:5,35:6,36:7,37:8,38:9,39:'\n'}
charz = {'a': 1, 'b': 2, 'c': 3, 'd': 4, 'e': 5, 'f': 6, 'g': 7, 'h': 8, 'i': 9, 'j': 10, 'k': 11, 'l': 12, 'm': 13,
@Ra1d7
Ra1d7 / compare.py
Created January 30, 2017 23:06
compare two lists
import random
lst1 = []
lst2 = []
dups = []
def func(lest):
while len(lest) < 32:
lest.append(random.randint(0,20))
func(lst1)
func(lst2)
for x in lst1:
@Ra1d7
Ra1d7 / testifprime.py
Created January 30, 2017 23:33
Tests if a number is a prime number or not
num = int(input('input a number: '))
lst = range(2, 1000)
la = []
for x in lst:
if x < num and x != num and x != 0 and num % x == 0:
la.append(x)
if la == []:
print('number ' + str(num) + ' is a prime number')
@Ra1d7
Ra1d7 / exercise12.py
Last active March 29, 2022 15:33
test
lst = range(0,100)
newlst = []
def func(lest):
global newlst
newlst.append(lest[-1])
newlst.append(lest[0])
func(lst)
print(newlst)
@Ra1d7
Ra1d7 / FibonacciNums.py
Created January 31, 2017 00:07
Generate fibonacci numbers (execrise 13)
num=int(input('Enter a number:'))
length=int(input('To what length u want it to be?:'))
nuz=0
list=[]
if len(str(num))>0:
list.append (num)
r=num+nuz
list.append (r)
while len(list)!=length:
dd=list[nuz]+list[nuz+1]
@Ra1d7
Ra1d7 / removedups.py
Created January 31, 2017 00:14
remove duplicates (exercise 14)
listwithdups = [1,2,2,3,456,4,654,984,3,21,65,132,1,321,32,165,4,654,32,1,321,321,32,16,54,549,84,3,21,6,5,5,5,55,6,9,9,8,7,4,9,8,4,65,456]
def removedups():
return set(listwithdups)
print(removedups())
@Ra1d7
Ra1d7 / reversewords.py
Created January 31, 2017 00:20
this will reverse your string! (exercise 15)
list = input('enter a string that you want to be reversed: ').split(' ')
list.reverse()
print(' '.join(list))
@Ra1d7
Ra1d7 / passwordgen.py
Created January 31, 2017 01:01
Generates a password based on user's opinion
import random
decid = input('how string do you want your password to be?(weak/medium/strong): ')
leng = int(input('how long do you want your password to be?: '))
weak = 'a:b:c:d:e:f:g:h:i:j:k:l:m:n:o:p:q:r:s:t:u:v:w:x:y:z'.split(':')
medium = '0:1:2:3:4:5:6:7:8:9'.split(':')
strong = '!:@:#:$:%:^:&:*:_:-:=:.'.split(':')
password = ''
if decid.lower() == 'weak':
while len(password) < leng:
password += weak[random.randint(0,25)]
@Ra1d7
Ra1d7 / analyzestring.py
Created January 31, 2017 16:43
prints to you how many characters are in a string or a file
decid = input('would you like to analyze a string or a file?')
def printit(cheer):
if cheer is not None or cheer != ' ':
if textls.count(cheer) != 0:
print(cheer + ":" + str(textls.count(cheer)))
elif cheer is None:
print("space:" + str(textls.count(cheer)))
elif cheer == '\n':
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Threading;
using System.Media;