Skip to content

Instantly share code, notes, and snippets.

from datetime import datetime
"""
Concepts for this week:
1.Getting user input
2.Manipulating strings (a few ways)
"""
name =input("Enter your name: ")
"""
Lists
More conditionals (if statements)
"""
cap=int(input("Enter nummber to cap list: "))
listbaba = [1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89]
newlist=[]
for item in listbaba:
"""
Lessons Learnt
Range command
Conditionals and Lists
"""
extent=int(input("Kindly enter a smaple number: "))
listbaba=range(1,extent+1) # range command is Powerfull!!
for item in listbaba:
"""
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:")
"""
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")
@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:
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: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):
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: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