+ 2

I creat a function in balconies challange

#input abal a=input() #input bbal b=input() #split '5,5' in to list and then convert in to intiger and then multiply with two value and give area def area(x): y=x.split(',') sum=1 for i in y: inti=int(i) sum=sum*inti return sum area_a=area(a) area_b=area(b) if area_a >area_b: print("Apartment A") else: print("Apartment B") It take two string number and convert into area What do you think about my first func area and how can modify more like it take only two number not more than that somthing like

15th Oct 2024, 3:35 AM
Shekh mo Mustkim
Shekh mo Mustkim - avatar
2 odpowiedzi
+ 9
Shekh mo Mustkim while your code works let me share a much simpler and cleaner way to write this code ``` def balconie(A,B): return "Apartment A" if A > B else "Apartment B" aw,al= map(int, input().split(',')) bw,bl= map(int, input().split(',')) print(balconie(aw*al,bw*bl)) ```
15th Oct 2024, 5:08 AM
BroFar
BroFar - avatar
+ 5
It's good But I thought I can clear in my own and solve the problem in my way that's why I write these messy code And I understand it very well how it work by these I can creat new things with different style
15th Oct 2024, 8:43 AM
Shekh mo Mustkim
Shekh mo Mustkim - avatar