Skip to content

Instantly share code, notes, and snippets.

@ShadowofZeus
ShadowofZeus / gist:20ed83f6f2a64df90b9e78920ced1db2
Created December 9, 2019 11:34
Exercise-16: Password Generator
import random
import string
def strongpassgenerator(password_length=12):
alphanum = string.ascii_letters + string.digits
return ''.join(random.choice(alphanum) for i in range(password_length))
samplestring=str(input("Kindly input a test string or sentence: "))
splitstring=samplestring.split()
splitstring.reverse()
print(splitstring)
@ShadowofZeus
ShadowofZeus / gist:e08d0761c1037008443e283b32be3a09
Created November 30, 2019 22:39
Exercise-14: Cleaning Duplicates
def clean_duplicates(sample_list):
cleanlist=set(sample_list)
print("List after duplicate cleaning:")
print(cleanlist)
def get_values():
@ShadowofZeus
ShadowofZeus / gist:69184ae1499e93d2fa3d441a74f62df1
Created November 30, 2019 21:45
Exercise 13 - Fibonnaci Numbers
"""
def welcome():
return(print("Welcome to Shadow's Coding Studio"))
def get_values():
capture_list=[1,1]
size_of_list=int(input("How many Fibonacci's to generate: "))
n=2
def welcome():
return(print("Welcome to Shadow's Coding Studio"))
def get_values():
capture_list=[]
size_of_list=int(input("Enter a number for the list size: "))
for i in range(1,size_of_list+1): # new for me!!
capture_var=int(input("Enter a number for your list: "))
@ShadowofZeus
ShadowofZeus / gist:c8186e442e0b9e1ca6233f3d3f8b9c7a
Created November 30, 2019 10:08
Prime-Numbers : Exercise-11
def input_value():
value=int(input("Kindly enter a sample number: "))
precheck(value) #doing prechecks on provided number
def welcome():
return(print("Welcome to Shadow's Coding Studio"))
def precheck(odd_prime):
a_list=random.sample(range(15), 7)
b_list = random.sample(range(10), 10)
newlist=[]
customlist = [newlist.append(b) for a in a_list for b in b_list if a==b]
print(newlist)
@ShadowofZeus
ShadowofZeus / gist:f9e2b32e9cfbc104eaef0565e5f73387
Created November 29, 2019 10:28
Exercise-9: Guessing Game One
import random
import sys
#a = random.randint(2, 6) #variable a will have a random integer that the computer made for you, between 2 and 6 (including 2 and 6).
def comparison(gvalue,rand_gen):
gvalue_int=int(gvalue)
if gvalue_int==rand_gen:
"""
Learning Outcomes:
-> While loops
-> Infinite loops
-> Break statements
"""
print("*********** MENU ***************")
print("Welcome to Rock, Paper , scissors \n")
print("Please select the below options:\n")
print("Select \n 'r' for Rock \n 's' for Scissors \n 'p' for Paper \n 'q' to exit program")
"""
Learning points for me:
Lists and sets(unique elements)
"""
a_list = [1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89]
b_list = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13]
new_list=[]
#overlap=int(input("Enter a number between 1 and 13: "))
print("Intersecting Numbers are:")