Search
Search titles only
By:
Search titles only
By:
Log in
Register
Search
Search titles only
By:
Search titles only
By:
Menu
Install the app
Install
Forums
New posts
All threads
Latest threads
New posts
Trending threads
Trending
Search forums
What's new
New posts
New ads
New profile posts
Latest activity
Free Ads
Latest reviews
Search ads
Members
Current visitors
New profile posts
Search profile posts
Contact us
Latest ads
එක පැකේජ් එකයි මාසෙටම Unlimited Internet. තාමත් DATA CARD දාන්න සල්ලි වියදම් කරනවද? අඩුම මිලට අපෙන්.
sayuru bandara
Updated:
Tuesday at 12:30 PM
Ad icon
ඉන්ටර්නෙට් එකෙන් හරියටම සල්ලි හොයන්න සහ Success වෙන්න කැමතිද? 🚀 (E-Money & Success Stories)
siri sumana
Updated:
Saturday at 11:44 PM
Gemini AI PRO 18 months Offer
Hawaka
Updated:
May 27, 2026
Ad icon
koko account
DasunEranga
Updated:
May 27, 2026
Ad icon
koko account
DasunEranga
Updated:
May 27, 2026
Electronics
Vehicles
Property
Search
Reply to thread
Forums
General
ElaKiri Talk!
Python Code help For Implement a list
Get the App
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Message
<blockquote data-quote="hancok" data-source="post: 27469113" data-attributes="member: 119642"><p>stock apu code kalla go kiyala function ekak asse danna one na. mama nikan damme passe recall karanna ona unoth kiyala</p><p></p><p>[CODE=python]def select_op(choice):</p><p> lst = ["","+","-","*","/","^","%"]</p><p> if choice == "#":</p><p> return 7</p><p> elif choice in lst:</p><p> return lst.index(choice)</p><p></p><p> # take input from the user</p><p>def inputfn():</p><p> choice = input("Enter choice(+,-,*,/,^,%,#,$): ")</p><p> </p><p> print(choice)</p><p> choicenum = select_op(choice)</p><p> </p><p> if(choicenum == 7):</p><p> #program ends here</p><p> print("Done. Terminating")</p><p> exit()</p><p> elif "$" in choice:</p><p> inputfn()</p><p> elif choicenum in range(1,7):</p><p> number1 = input("Enter first number: ")</p><p> print(number1)</p><p> if "$" in number1:</p><p> go()</p><p> if "#" in number1:</p><p> print("Done. Terminating")</p><p> exit()</p><p> number2 = input("Enter second number: ")</p><p> print(number2)</p><p> if "$" in number2:</p><p> go()</p><p> if "#" in number2:</p><p> print("Done. Terminating")</p><p> exit()</p><p> </p><p> if choicenum == 1:</p><p> print(float(number1),"+",float(number2),"=",float(number1) + float(number2))</p><p> </p><p> elif choicenum == 2:</p><p> print(float(number1),"+",float(number2),"=",float(number1) - float(number2))</p><p> </p><p> elif choicenum == 3:</p><p> print(float(number1),"+",float(number2),"=",float(number1) * float(number2))</p><p> </p><p> elif choicenum == 4:</p><p> if number2 == "0":</p><p> print("float division by zero")</p><p> print(float(number1),"/",float(number2),"=","None")</p><p> else:</p><p> print(float(number1),"+",float(number2),"=",float(number1) / float(number2))</p><p> </p><p> elif choicenum == 5:</p><p> print(float(number1),"+",float(number2),"=",float(number1) ** float(number2))</p><p> </p><p> elif choicenum == 6:</p><p> print(float(number1),"+",float(number2),"=",float(number1) % float(number2))</p><p> </p><p> </p><p>def go():</p><p> while True:</p><p> print("Select operation.")</p><p> print("1.Add : + ")</p><p> print("2.Subtract : - ")</p><p> print("3.Multiply : * ")</p><p> print("4.Divide : / ")</p><p> print("5.Power : ^ ")</p><p> print("6.Remainder: % ")</p><p> print("7.Terminate: # ")</p><p> print("8.Reset : $ ")</p><p> inputfn()</p><p></p><p>go()</p><p> </p><p> </p><p>[/CODE]</p><p></p><p></p><p>ah na na go() kiyana eka define karanna one. madin recall wela neh</p></blockquote><p></p>
[QUOTE="hancok, post: 27469113, member: 119642"] stock apu code kalla go kiyala function ekak asse danna one na. mama nikan damme passe recall karanna ona unoth kiyala [CODE=python]def select_op(choice): lst = ["","+","-","*","/","^","%"] if choice == "#": return 7 elif choice in lst: return lst.index(choice) # take input from the user def inputfn(): choice = input("Enter choice(+,-,*,/,^,%,#,$): ") print(choice) choicenum = select_op(choice) if(choicenum == 7): #program ends here print("Done. Terminating") exit() elif "$" in choice: inputfn() elif choicenum in range(1,7): number1 = input("Enter first number: ") print(number1) if "$" in number1: go() if "#" in number1: print("Done. Terminating") exit() number2 = input("Enter second number: ") print(number2) if "$" in number2: go() if "#" in number2: print("Done. Terminating") exit() if choicenum == 1: print(float(number1),"+",float(number2),"=",float(number1) + float(number2)) elif choicenum == 2: print(float(number1),"+",float(number2),"=",float(number1) - float(number2)) elif choicenum == 3: print(float(number1),"+",float(number2),"=",float(number1) * float(number2)) elif choicenum == 4: if number2 == "0": print("float division by zero") print(float(number1),"/",float(number2),"=","None") else: print(float(number1),"+",float(number2),"=",float(number1) / float(number2)) elif choicenum == 5: print(float(number1),"+",float(number2),"=",float(number1) ** float(number2)) elif choicenum == 6: print(float(number1),"+",float(number2),"=",float(number1) % float(number2)) def go(): while True: print("Select operation.") print("1.Add : + ") print("2.Subtract : - ") print("3.Multiply : * ") print("4.Divide : / ") print("5.Power : ^ ") print("6.Remainder: % ") print("7.Terminate: # ") print("8.Reset : $ ") inputfn() go() [/CODE] ah na na go() kiyana eka define karanna one. madin recall wela neh [/QUOTE]
Insert quotes…
Verification
Dawasata paya keeyak thibeda?
Post reply
Top
Bottom