+ 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
9 Respuestas
+ 15
naughty $Vengat, you should have been doing your homework instead of watching anime!
+ 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.
+ 6
@Ahri I am stuck
+ 6
on what, specifically?
+ 5
I actually hate anime lmao.
I tried 6hours a day doing these questions
+ 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
+ 3
@$Vengat
I think I solved it with @Ipang's code.
https://code.sololearn.com/c00N9wu0NM2h/#py
+ 2
I need help with 2)
+ 1
I did 1)
we were not supposed to use what we didn't learn, including dictionaries but I used dictionaries as last resort