+ 9

Some Python questions I need help with

1) you have 4 tuples, a,b,c,d. Write an *efficient* program that returns one element from each tuple such that their sum is 0. Assume there is only one solution. 2) Write a function change(a,b,c,d,X), where a,b,c,d,X are 5,10,20 and 100 cent coins in your wallet and money you need to pay is given as X. Return a list of coins per type followed by total number of coins, [5,10,20,100,total] if possible, else return -1. Thanks! I have to submit these questions by Thursday! Help with this homework is appreciated

26th Sep 2017, 10:43 AM
👑 Prometheus 🇸🇬
👑 Prometheus 🇸🇬 - avatar
9 Respuestas
+ 15
naughty $Vengat, you should have been doing your homework instead of watching anime!
26th Sep 2017, 10:53 AM
Ahri Fox
Ahri Fox - avatar
+ 10
for 1: be snarky and set tuples values to 0 for 2: while wallet are not zero, if above c subtract d, if above above b subtract c, if above a subtract b, else subtract a. that's the logic "psudeocode" of what you want to do. I'll leave you to figure out code bits, but if you're stuck, ask.
26th Sep 2017, 11:09 AM
Ahri Fox
Ahri Fox - avatar
+ 6
@Ahri I am stuck
26th Sep 2017, 12:39 PM
👑 Prometheus 🇸🇬
👑 Prometheus 🇸🇬 - avatar
+ 6
on what, specifically?
26th Sep 2017, 2:33 PM
Ahri Fox
Ahri Fox - avatar
+ 5
I actually hate anime lmao. I tried 6hours a day doing these questions
26th Sep 2017, 10:53 AM
👑 Prometheus 🇸🇬
👑 Prometheus 🇸🇬 - avatar
+ 4
@$Vengat, I thought you were kidding about this, or it's a prank, is it? I suck in Python, but then again, here's my logic in c++ for #2, it's far from what you expected, but it's similar purpose. https://code.sololearn.com/cY3WH2OkYN50/?ref=app
26th Sep 2017, 3:03 PM
Ipang
+ 3
@$Vengat I think I solved it with @Ipang's code. https://code.sololearn.com/c00N9wu0NM2h/#py
27th Sep 2017, 8:03 AM
Ferhat Sevim
Ferhat Sevim - avatar
+ 2
I need help with 2)
26th Sep 2017, 2:34 PM
👑 Prometheus 🇸🇬
👑 Prometheus 🇸🇬 - avatar
+ 1
I did 1) we were not supposed to use what we didn't learn, including dictionaries but I used dictionaries as last resort
26th Sep 2017, 2:34 PM
👑 Prometheus 🇸🇬
👑 Prometheus 🇸🇬 - avatar