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
Ad icon
port.lk Domain for sale
Lankan-Tech
Updated:
Today at 3:55 PM
Colombo
Kaduwela - Two Storey House for Sale
dilrasan
Updated:
Thursday at 2:23 PM
Ad icon
Wechat qr verification
Pawan2005
Updated:
Thursday at 1:28 AM
🚀 GOOGLE AI PRO 18 MONTHS ACTIVATION 🚀
sayuru bandara
Updated:
Wednesday at 5:34 PM
Pure VPN - Up to 27 Months
vgp
Updated:
Jun 5, 2026
Electronics
Vehicles
Property
Search
Reply to thread
Forums
Computers & Internet
Software Development
Uom python course 1 assignment part 1
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="IT kolla" data-source="post: 27682132" data-attributes="member: 580164"><p>menna mehema EOFError kiyala awlak enawane me code eke?</p><p></p><p>[ATTACH=full]170164[/ATTACH]</p><p></p><p>code eka:</p><p></p><p>[CODE=python]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> </p><p> def add(x,y):</p><p> return x+y</p><p></p><p> def substract(x,y):</p><p> return x-y</p><p></p><p> def multiply(x,y):</p><p> return x*y</p><p></p><p> def divide(x,y):</p><p> return x/y</p><p></p><p> def power(x,y):</p><p> return x**y</p><p></p><p> def remainder(x,y):</p><p> return x%y</p><p> </p><p> </p><p> # take input from the user</p><p> choice = input("Enter choice(+,-,*,/,^,%,#,$): ")</p><p> print(choice)</p><p> if choice == "#":</p><p> #program ends here</p><p> print("Done. Terminating")</p><p> exit()</p><p> if choice == "$":</p><p> continue</p><p> try:</p><p> a=input("Enter first number: ")</p><p> print(a)</p><p> a=float(a)</p><p> </p><p> b=input("Enter second number: ")</p><p> print(b)</p><p> b=float(b)</p><p> except:</p><p> continue</p><p></p><p> if choice == "+":</p><p> print(a, "+", b, "=", add(a,b))</p><p></p><p> elif choice == "-":</p><p> print(a, "-", b, "=", substract(a,b))</p><p></p><p> elif choice == "*":</p><p> print(a, "*", b, "=", multiply(a,b))</p><p></p><p> elif choice == "/":</p><p> if b == 0.0:</p><p> print("float division by zero")</p><p> print(a, "/", b, "=" " None")</p><p> else:</p><p> print(a, "/", b, "=", divide(a,b))</p><p> </p><p> elif choice == '^':</p><p> print(a, "^", b, "=", power(a,b))</p><p></p><p> elif choice == "%":</p><p> print(a, "%", b, "=", remainder(a,b))</p><p></p><p> else :</p><p> print("Unrecognized operation")</p><p>[/CODE]</p></blockquote><p></p>
[QUOTE="IT kolla, post: 27682132, member: 580164"] menna mehema EOFError kiyala awlak enawane me code eke? [ATTACH type="full"]170164[/ATTACH] code eka: [CODE=python]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 : $ ") def add(x,y): return x+y def substract(x,y): return x-y def multiply(x,y): return x*y def divide(x,y): return x/y def power(x,y): return x**y def remainder(x,y): return x%y # take input from the user choice = input("Enter choice(+,-,*,/,^,%,#,$): ") print(choice) if choice == "#": #program ends here print("Done. Terminating") exit() if choice == "$": continue try: a=input("Enter first number: ") print(a) a=float(a) b=input("Enter second number: ") print(b) b=float(b) except: continue if choice == "+": print(a, "+", b, "=", add(a,b)) elif choice == "-": print(a, "-", b, "=", substract(a,b)) elif choice == "*": print(a, "*", b, "=", multiply(a,b)) elif choice == "/": if b == 0.0: print("float division by zero") print(a, "/", b, "=" " None") else: print(a, "/", b, "=", divide(a,b)) elif choice == '^': print(a, "^", b, "=", power(a,b)) elif choice == "%": print(a, "%", b, "=", remainder(a,b)) else : print("Unrecognized operation") [/CODE] [/QUOTE]
Insert quotes…
Verification
Awruddata maasa keeyada?
Post reply
Top
Bottom