1st Apr 2021, 3:34 PM
Mohammed Ramadhan
Mohammed Ramadhan - avatar
13 Respostas
+ 1
The origanalRevenue isn't actually 15000. I think it's 530 but i could be wrong. I'd try that first and then maybe look over your for loop. This is what I used. I can explain my code if you'd like nya = 0 for x in data.values(): if x < age: nya += 5 else: nya += 20
1st Apr 2021, 7:54 PM
Alexander Crum
Alexander Crum - avatar
0
Thanks I'll try.
1st Apr 2021, 7:59 PM
Mohammed Ramadhan
Mohammed Ramadhan - avatar
0
Let me know how it goes
1st Apr 2021, 8:04 PM
Alexander Crum
Alexander Crum - avatar
0
Ok
1st Apr 2021, 8:06 PM
Mohammed Ramadhan
Mohammed Ramadhan - avatar
0
The if condition of your loop produces the wrong results
1st Apr 2021, 8:45 PM
Mohammed Ramadhan
Mohammed Ramadhan - avatar
0
Thats strange. It works for me. Are you sure you've got the old revenue right now?
1st Apr 2021, 9:07 PM
Alexander Crum
Alexander Crum - avatar
0
try using 16 and 10 as discounted age and if you get 5 and 33 respectively as percentage revenue growth then it means you are correct.
2nd Apr 2021, 3:16 AM
Mohammed Ramadhan
Mohammed Ramadhan - avatar
0
And please show your full code for me to see how you have worked out except for the dictionary collection
2nd Apr 2021, 3:29 AM
Mohammed Ramadhan
Mohammed Ramadhan - avatar
0
The reason why I'm saying you are wrong is your loop multiplies the next value in value list by twice the variable ticket cause of += sign
2nd Apr 2021, 3:33 AM
Mohammed Ramadhan
Mohammed Ramadhan - avatar
2nd Apr 2021, 3:39 AM
Mohammed Ramadhan
Mohammed Ramadhan - avatar
0
Try my code and compare with yours
2nd Apr 2021, 3:40 AM
Mohammed Ramadhan
Mohammed Ramadhan - avatar
0
#your code goes here gamla = 0 for x in data.values(): if x < 18: gamla += 5 else: gamla += 20 nya = 0 for x in data.values(): if x < age: nya += 5 else: nya += 20 print(int(100 * (nya - gamla)/ gamla))
2nd Apr 2021, 5:58 AM
Alexander Crum
Alexander Crum - avatar
0
Your method works
2nd Apr 2021, 7:11 PM
Mohammed Ramadhan
Mohammed Ramadhan - avatar