Compare commits
No commits in common. "d97e42d71701066a19cf590132b2766e03dc0346" and "2bbeb9da0699e6c55f4253f344f3826f7a9d553c" have entirely different histories.
d97e42d717
...
2bbeb9da06
|
@ -1,9 +0,0 @@
|
||||||
|
|
||||||
def swap(list):
|
|
||||||
m_list = list[0], list[-1] = list[-1], list[0]
|
|
||||||
return m_list
|
|
||||||
|
|
||||||
values_list = input().split(',') # Program receives comma-separated values like 5,4,12,19
|
|
||||||
swap(values_list)
|
|
||||||
|
|
||||||
print(values_list)
|
|
|
@ -1,12 +0,0 @@
|
||||||
gas_const = 8.3144621
|
|
||||||
|
|
||||||
def compute_gas_volume(pressure, temperature, moles):
|
|
||||||
return (moles * gas_const * temperature) / pressure
|
|
||||||
|
|
||||||
gas_pressure = float(input())
|
|
||||||
gas_moles = float(input())
|
|
||||||
gas_temperature = float(input())
|
|
||||||
gas_volume = 0.0
|
|
||||||
|
|
||||||
gas_volume = compute_gas_volume(gas_pressure, gas_temperature, gas_moles)
|
|
||||||
print('Gas volume:', gas_volume, 'm^3')
|
|
|
@ -1,6 +0,0 @@
|
||||||
def swap_values(user_val1, user_val2):
|
|
||||||
return user_val2, user_val1
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
val1, val2 = swap_values(input(), input())
|
|
||||||
print('{0} {1}'.format(val1, val2))
|
|
|
@ -1,46 +0,0 @@
|
||||||
coins = [
|
|
||||||
['Dollars', 'Dollar'],
|
|
||||||
['Quarters', 'Quarter'],
|
|
||||||
['Dimes', 'Dime'],
|
|
||||||
['Nickels', 'Nickel'],
|
|
||||||
['Pennies', 'Penny']]
|
|
||||||
|
|
||||||
def coin_enumeration(change):
|
|
||||||
if len(change) != 0:
|
|
||||||
for coin in coins:
|
|
||||||
num_coins = change.count(coin)
|
|
||||||
if num_coins != 0:
|
|
||||||
if num_coins > 1:
|
|
||||||
print('{0} {1}'.format(num_coins, coin[0].lower()))
|
|
||||||
else:
|
|
||||||
print('{0} {1}'.format(num_coins, coin[1].lower()))
|
|
||||||
else:
|
|
||||||
print('no change')
|
|
||||||
|
|
||||||
def fit_coin(to_make, coin_val):
|
|
||||||
num_coin = to_make // coin_val
|
|
||||||
remainder = to_make - (num_coin * coin_val)
|
|
||||||
|
|
||||||
return num_coin, remainder
|
|
||||||
|
|
||||||
def exact_change(input_val):
|
|
||||||
nd, input_val = fit_coin(input_val, 100)
|
|
||||||
nq, input_val = fit_coin(input_val, 25)
|
|
||||||
ndime, input_val = fit_coin(input_val, 10)
|
|
||||||
nn, input_val = fit_coin(input_val, 5)
|
|
||||||
np, input_val = fit_coin(input_val, 1)
|
|
||||||
|
|
||||||
return nd, nq, ndime, nn, np
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
change = []
|
|
||||||
input_val = int(input())
|
|
||||||
num_dollars, num_quarters, num_dimes, num_nickels, num_pennies = exact_change(input_val)
|
|
||||||
|
|
||||||
change.extend([coins[0] for i in range(num_dollars)])
|
|
||||||
change.extend([coins[1] for i in range(num_quarters)])
|
|
||||||
change.extend([coins[2] for i in range(num_dimes)])
|
|
||||||
change.extend([coins[3] for i in range(num_nickels)])
|
|
||||||
change.extend([coins[4] for i in range(num_pennies)])
|
|
||||||
|
|
||||||
coin_enumeration(change)
|
|
|
@ -1,19 +0,0 @@
|
||||||
def find_max(num_1, num_2):
|
|
||||||
max_val = 0.0
|
|
||||||
|
|
||||||
if (num_1 > num_2): # if num1 is greater than num2,
|
|
||||||
max_val = num_1 # then num1 is the maxVal.
|
|
||||||
else: # Otherwise,
|
|
||||||
max_val = num_2 # num2 is the maxVal
|
|
||||||
return max_val
|
|
||||||
|
|
||||||
max_sum = 0.0
|
|
||||||
|
|
||||||
num_a = float(input())
|
|
||||||
num_b = float(input())
|
|
||||||
num_y = float(input())
|
|
||||||
num_z = float(input())
|
|
||||||
|
|
||||||
max_sum = sum([max([num_a, num_b]), max([num_y, num_z])])
|
|
||||||
|
|
||||||
print('max_sum is:', max_sum)
|
|
|
@ -1,9 +0,0 @@
|
||||||
|
|
||||||
def pyramid_volume(base_length, base_width, pyramid_height):
|
|
||||||
return(((base_length * base_width) * pyramid_height) * (1/3))
|
|
||||||
|
|
||||||
|
|
||||||
length = float(input())
|
|
||||||
width = float(input())
|
|
||||||
height = float(input())
|
|
||||||
print('Volume for 4.5, 2.1, 3.0 is:', pyramid_volume(length, width, height))
|
|
|
@ -1,8 +0,0 @@
|
||||||
|
|
||||||
def mph_and_minutes_to_miles(mph, dt):
|
|
||||||
return (dt / 60) * mph
|
|
||||||
|
|
||||||
miles_per_hour = float(input())
|
|
||||||
minutes_traveled = float(input())
|
|
||||||
|
|
||||||
print('Miles: {:f}'.format(mph_and_minutes_to_miles(miles_per_hour, minutes_traveled)))
|
|
|
@ -1,22 +0,0 @@
|
||||||
|
|
||||||
def get_user_num():
|
|
||||||
# This is bad practice, you should use python ABC or raise NotImplementedError instead.
|
|
||||||
print('FIXME: Finish get_user_num()')
|
|
||||||
return -1
|
|
||||||
#raise NotImplementedError
|
|
||||||
|
|
||||||
def compute_avg(user_num1, user_num2):
|
|
||||||
# This is bad practice, you should use python ABC or raise NotImplementedError instead.
|
|
||||||
print('FIXME: Finish compute_avg()')
|
|
||||||
return -1
|
|
||||||
#raise NotImplementedError
|
|
||||||
|
|
||||||
user_num1 = 0
|
|
||||||
user_num2 = 0
|
|
||||||
avg_result = 0
|
|
||||||
|
|
||||||
user_num1 = get_user_num()
|
|
||||||
user_num2 = get_user_num()
|
|
||||||
avg_result = compute_avg(user_num1, user_num2)
|
|
||||||
|
|
||||||
print('Avg:', avg_result)
|
|
|
@ -1,12 +0,0 @@
|
||||||
|
|
||||||
def print_popcorn_time(bag_ounces):
|
|
||||||
if bag_ounces < 3:
|
|
||||||
print('Too small') # This should be returned instead.
|
|
||||||
elif bag_ounces > 10:
|
|
||||||
print('Too large') # This should be returned instead.
|
|
||||||
else:
|
|
||||||
print('{0} seconds'.format(6 * bag_ounces)) # This should be returned instead.
|
|
||||||
|
|
||||||
|
|
||||||
user_ounces = int(input())
|
|
||||||
print_popcorn_time(user_ounces)
|
|
|
@ -1,13 +0,0 @@
|
||||||
|
|
||||||
def shampoo_instructions(num_cycles):
|
|
||||||
if num_cycles < 1:
|
|
||||||
print('Too few.')
|
|
||||||
elif num_cycles > 4:
|
|
||||||
print('Too many.')
|
|
||||||
else:
|
|
||||||
for i in range(num_cycles):
|
|
||||||
print('{0} : Lather and rinse.'.format(i + 1))
|
|
||||||
print('Done.')
|
|
||||||
|
|
||||||
user_cycles = int(input())
|
|
||||||
shampoo_instructions(user_cycles)
|
|
Loading…
Reference in New Issue