This file contains hidden or 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
from datetime import datetime | |
""" | |
Concepts for this week: | |
1.Getting user input | |
2.Manipulating strings (a few ways) | |
""" | |
name =input("Enter your name: ") |
This file contains hidden or 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
""" | |
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: |
This file contains hidden or 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
""" | |
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: |
This file contains hidden or 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
""" | |
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:") |
This file contains hidden or 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
""" | |
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") |
This file contains hidden or 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 | |
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: |
This file contains hidden or 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_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) |
This file contains hidden or 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
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): |
This file contains hidden or 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
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: ")) |
This file contains hidden or 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
""" | |
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 |
OlderNewer