Wondered about the weight ratio of an African Swallow to a coconut

6 People have highlighted this activity

People who have Wondered about the weight ratio of an African Swallow to a coconut

Activity Feed

Instructor, Codecraft Works
May 12, 2022
Day 5 of #100daysofcode (Life has been busy, in an amazing way, but I skipped some days back on track now though!) today went over using for loops and range functions to iterate over lists of data. Through this project I was able to create a random password generator using amounts of letters/symbols/numbers input by the user.

# Password Generator Project
import random

letters = ['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', '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']
numbers = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9']
symbols = ['!', '#', '$', '%', '&', '(', ')', '*', '+']

print("Welcome to the PyPassword Generator!")
nr_letters = int(input("How many letters would you like in your password?\n"))
nr_symbols = int(input(f"How many symbols would you like?\n"))
nr_numbers = int(input(f"How many numbers would you like?\n"))

password_list = []

# Iterates through characters in the letter list with a range of 1 and amount of letters chosen + 1 to account for
# starting at 0. Then adds the random chosen letters to the password_list.

for char in range(1, nr_letters + 1):
    password_list.append(random.choice(letters))

# Iterates through characters in the symbol list with a range of 1 and amount of symbols chosen + 1 to account for
# starting at 0. Then adds the random chosen symbols to the password_list.
for symbol in range(1, nr_symbols + 1):
    password_list.append(random.choice(symbols))

# Iterates through characters in the number list with a range of 1 and amount of numbers chosen + 1 to account for
# starting at 0. Then adds the random chosen numbers to the password_list.
for number in range(1, nr_numbers + 1):
    password_list.append(random.choice(numbers))

# Creates a random shuffle of the items in password_list.
random.shuffle(password_list)

# Sets password to empty string.
password = ""

# Iterates over the characters in the newly shuffled password_list and adds each character into the empty password
# string.

for char in password_list:
    password += char

# Prints newly generated randomized password.print(f"Your password is : \n {password}")

as always if you would like to test it out here is the replit link:
https://replit.com/@JamesBarlow3/password-generator-start-1#main.py
Read more
Instructor, Codecraft Works
May 07, 2022
# Imports the random module
import random

# Assigns ascii art to variables representing each choice.
rock = '''
    _______
---'   ____)
      (_____)
      (_____)
      (____)
---.__(___)
'''

paper = '''
    _______
---'   ____)____
          ______)
          _______)
         _______)
---.__________)
'''

scissors = '''
    _______
---'   ____)____
          ______)
       __________)
      (____)
---.__(___)
'''
# Welcome message and game prompt
user_input = input("Welcome to Rock, Paper, Scissors! What do you chose? Type 0 for rock, 1 for paper, 2 for scissors \n")
# Assign the computers choice at random
computer_choice = random.randint(0, 2)

# Converts users choice into an integer for easy calculation and comparisons
user_as_int = int(user_input)

# If statement for user choosing invalid option, prints out invalid option message if condition is true.
if user_as_int >= 3 or user_as_int < 0:
    print("You selected an invalid option, you lose")

# If block for user choosing rock, runs through 3 conditions, computer choosing rock, computer choosing paper
# computer choosing scissors. Then assigning Win/Lose/Tie accordingly
if user_as_int == 0 and computer_choice == 0:
    print(f"You chose \n {rock} \n Computer also chose \n {rock} It\'s a Tie.")
if user_as_int == 0 and computer_choice == 1:
    int(f"You chose \n {rock} \n Computer has chosen \n {paper} You lose.")
if user_as_int == 0 and computer_choice == 2:
    print(f"You chose \n {rock} \n Computer has chosen \n {scissors} YOU WIN!!")

# If Block for user choosing scissors, works same as rock.
if user_as_int == 1 and computer_choice == 0:
    print(f"You chose \n {paper} \n Computer has chosen \n {rock} YOU WIN!!")
if user_as_int == 1 and computer_choice == 1:
    print(f"You chose \n {paper} \n Computer also chose \n {paper} It\'s a Tie.")
if user_as_int == 1 and computer_choice == 2:
    print(f"You chose \n {paper} \n Computer has chosen \n {scissors} You lose.")

if user_as_int == 2 and computer_choice == 0:
    print(f"You chose \n {scissors} \n Computer has chosen \n {rock} You lose.")
if user_as_int == 2 and computer_choice == 1:
    print(f"You chose \n {scissors} \n Computer has chosen \n {paper} YOU WIN!!!")
if user_as_int == 2 and computer_choice == 2:
    print(f"You chose \n {scissors} \n Computer has chosen \n {scissors} It\'s a Tie.")
As always here is the replit link if you wish to play:
https://replit.com/@JamesBarlow3/rock-paper-scissors-start-1#main.py
Read more
Instructor, Codecraft Works
May 06, 2022
Day 3 focused on basic control flow with; if/elif statements, nested if statements, and logical operators. 

My project for the day was to make a simple choose your own adventure game, here is the result! As always the project is linked in replit if you want to try it out

print('''
*******************************************************************************
          |                   |                  |                     |
 _________|________________.=""_;=.______________|_____________________|_______
|                   |  ,-"_,=""     `"=.|                  |
|___________________|__"=._o`"-._        `"=.______________|___________________
          |                `"=._o`"=._      _`"=._                     |
 _________|_____________________:=._o "=._."_.-="'"=.__________________|_______
|                   |    __.--" , ; `"=._o." ,-"""-._ ".   |
|___________________|_._"  ,. .` ` `` ,  `"-._"-._   ". '__|___________________
          |           |o`"=._` , "` `; .". ,  "-._"-._; ;              |
 _________|___________| ;`-.o`"=._; ." ` '`."\` . "-._ /_______________|_______
|                   | |o;    `"-.o`"=._``  '` " ,__.--o;   |
|___________________|_| ;     (#) `-.o `"=.`_.--"_o.-; ;___|___________________
____/______/______/___|o;._    "      `".o|o_.--"    ;o;____/______/______/____
/______/______/______/_"=._o--._        ; | ;        ; ;/______/______/______/_
____/______/______/______/__"=._o--._   ;o|o;     _._;o;____/______/______/____
/______/______/______/______/____"=._o._; | ;_.--"o.--"_/______/______/______/_
____/______/______/______/______/_____"=.o|o_.--""___/______/______/______/____
/______/______/______/______/______/______/______/______/______/______/_____ /
*******************************************************************************
''')
print("Welcome to Treasure Island.")
print("Your mission is to find the treasure.")

crossroad = input("You\'re at a cross road. Where do you want to go? Type "'left'" or "'right'" \n")

if crossroad.lower() == "right":
    lake = input("You\'ve come to a lake. There is an island in the middle of the lak. Type "'wait'" to wait for a boat. Type "'swim'" to swim across.\n").lower()
    if lake == "wait":
        color = input("You arrive at the island unharmed there are three doors, one red one blue, and one yellow. Which color do you choose?\n").lower()
        if color == "red":
            print("When you steop into the room you fall into a bottomless pit. Game Over")
        elif color == "blue":
            print("The room locks behind you and you are attacked by killer teddy bears. Game Over")
        elif color == "yellow":
            print("You have found the treasure. You win!")
    else:
        print("As you swim across, a pack of man eating otters attack you. Game Over")
else:
    print("You have walk down road left of the fork where waiting for you is a honey badger, it eats your face off and you lose.")



https://replit.com/@JamesBarlow3/treasure-island-start-1#main.py
Read more
Instructor, Codecraft Works
May 05, 2022
# If the bill was $150.00, split between 5 people, with 12% tip.

# Each person should pay (150.00 / 5) * 1.12 = 33.6
# Format the result to 2 decimal places = 33.60

# Tip: There are 2 ways to round a number. You might have to do some Googling to solve this.💪

# Write your code below this line 👇

# Welcome Message
print("Welcome to the tip calculator! ")

# Ask for total bill
bill_amount = float(input("What was the total bill? \n"))

# Ask for tip percentage
tip_amount = int(input("How much tip would you like to give? 15, 18, 20 or custom percent? \n"))

# Ask for amount of people splitting the bill
bill_split_amount = int(input("How many people to split the bill? \n"))

# Calculate total bill with tip
total_bill = bill_amount + (bill_amount * (tip_amount/100))

# Calculate bill per person
bill_per_person = round(total_bill/bill_split_amount, 2)


# Print bill for each person using f-string,
print(f"Each person should pay: {bill_per_person}")
https://replit.com/@JamesBarlow3/tip-calculator-start#main.py
Read more
Instructor, Codecraft Works
May 04, 2022
Now that my most recent college semester is over, I committed to a #100daysofcode challenge, I am using a 100 days of python program that while very basic to start, gradually increase in complexity. 
I already have a lot of the initial knowledge however, to keep my self accountable I plan on going through the course as if I had none. 

This first project is creating a band name generator that takes the input of the name of the city the user grew up with and combines it with a name of a pet in order to output a combined band name.


#Greeting for program
print("Hello, welcome to the band name generator")
#Ask user for the city that they grew up in.
city = input("What city did you grow up in? \n")
#Ask user for the name of a pet
pet_name = input("What is the name of your pet? \n")
#Combine the name of the city and pet to produce a band name
print("Your band name could be " + city + " " + pet + "\n")

https://replit.com/@JamesBarlow3/band-name-generator-start-1#main.py

Read more
Student Advisor, Nucamp Coding Bootcamp
Oct 03, 2021
Not just Monty Python -- do you have Python experience? Check out instructor roles with  Nucamp Coding Bootcamp (part-time, fully remote).
Read more