Skip to content

Instantly share code, notes, and snippets.

View eddyruhana's full-sized avatar

Eddy K Ruhana eddyruhana

  • Arlington, TX
View GitHub Profile
@eddyruhana
eddyruhana / PY0101EN-1-1-Types.ipynb
Created December 22, 2020 20:21
Created on Skills Network Labs
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@eddyruhana
eddyruhana / PY0101EN-1-1-Types.ipynb
Created December 22, 2020 20:14
Created on Skills Network Labs
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@eddyruhana
eddyruhana / count_ones.py
Created August 27, 2019 21:18
Given a list filled with 0s and 1s, find the maximum number of consecutive 1s in this list.
# Given a list filled with 0s and 1s, find the maximum number of consecutive 1s in this list.
# List of 0s and 1s
track_ones = [1,1,0,1,1,1]
def find_max():
count_ones = []
only_ones = []
ones = 0
@eddyruhana
eddyruhana / inventory.csv
Last active August 22, 2019 19:39
A program that manages an inventory of products. I created a product class which has a price, id and quantity on hand. An inventory class which keeps track of various products and can sum up the inventory value.
id name price_per_unit quantity_on_hand
1001 prod1 500 11
1002 prod2 155.5 8
1003 prod3 183 13
1004 prod4 380.35 19
1005 prod5 950 0
1006 prod6 420 20
@eddyruhana
eddyruhana / atm_account.py
Created August 13, 2019 02:23
A Program to manage a bank account. Manage credits and debits from these accounts through an ATM style program where you can make deposits and withdrawals
# Account has: Account Number (6 digits), PIN Number (4 digits), balance ($)
"""
INSTRUCTION: The file: 'atm_account_database.csv' is the bank accounts database.
The database contains all the existing Account users, Account Numbers, Account PINs and Current balances
Some of the existing accounts are:
- User: Eddy, Account Number: 123456, Account PIN: 1234
- User: Manuella, Account Number: 123457, Account PIN: 1235
All transactions are handled by the ATM Machine.
"""
@eddyruhana
eddyruhana / sortByColumn.py
Created July 31, 2019 23:12
This program reads the file Countries.csv saved in the same directory. The program asks the user how they would like their CSV file sorted: by Country Name, Literacy, infant mortality, population or net migration.
# Must import the 'pandas' library. Ref: https://pandas.pydata.org/getpandas.html
# panda website tutorial: https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.index.html#pandas.DataFrame.index
# This program assumes that you have the file: Countries.csv saved in the same directory
import pandas as pan
# Load the file data
fLoad = pan.read_csv('Countries.csv')
# Sort by Columns: Name, GDPPC, Literacy, InfantMortality, Population or NetMigration
@eddyruhana
eddyruhana / MyAirlines.py
Created July 29, 2019 20:18
A reservation system which book airline seats. It charges various rates for particular sections. Also keeping track of how much money the airline company has made in tickets sales.
# A reservation system which books airline seats.
# My Airplane is an Airbus A340-200 with a total of 50 passengers seats
# First Class: 8 seats (Round Trip: $634.37 per seat; One Way: $380.96 per seat)
# Business Class: 12 seats (Round Trip: $579.25 per seat; One Way: $347.43 per seat)
# Economy: 30 seats (Round Trip: $182.99 per seat; One Way: $109.89 per seat)
import datetime
# Keep Track of Seats availability:
seatsTaken_firstClass = []
@eddyruhana
eddyruhana / Question_Pool.txt
Last active July 11, 2019 19:52
Generate Questions for a Test of Elementary Algebra
1#If a number is divided by 4, then 3 is subtracted, the result is 0. What is the number? {a. 4, b. 3, c. 10, d. 12}
1001#d
2#Solve X where 3(x + 1) = 5(x - 2) + 7 {a. -2, b. 2, c. 1/2, d. 3}
1002#d
3#Which of the following is closest to the square root of 10.5? {a. 3, b. 5, c. 4, d. 2}
1003#a
4#A father gave $500 to his two sons. He gave X dollars to one son. Which of the following expressions correctly shows the amount he gave to the other? {a. 500 + X, b. 500 / X, c. 500 x X, d. 500 - X}
1004#d
5#Solve X where 5X = 20 {a. 4, b. 5, c. 10, d. 15}
1005#a
# Code by Eddy Ruhana (Software Developer)
# A Function that accepts a word as a parameter and returns it in Pig Latin.
class PigLatin:
def __init__(self, a_word):
"""Class that will convert words into PigLatin"""
self.a_word = a_word
def returnPigLatin(self):
"""Take a word and convert it in Pig Latin"""
"""
Given a non-empty list of integers, every element appears twice except for one. Find that single one.
~ Solved by Eddy Ruhana
"""
intlist = [1, 1, 0, 2, 2, 3, 3, 5, 5, 4, 4]
enum_list = enumerate(intlist, 0)
duplicate_list = []