Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
PyNoneOr
Language:
Ada
Assembly
Bash
C#
C++ (gcc)
C++ (clang)
C++ (vc++)
C (gcc)
C (clang)
C (vc)
Client Side
Clojure
Common Lisp
D
Elixir
Erlang
F#
Fortran
Go
Haskell
Java
Javascript
Kotlin
Lua
MySql
Node.js
Ocaml
Octave
Objective-C
Oracle
Pascal
Perl
Php
PostgreSQL
Prolog
Python
Python 3
R
Rust
Ruby
Scala
Scheme
Sql Server
Swift
Tcl
Visual Basic
Layout:
Vertical
Horizontal
#python 3.6.9 #PyNoneOr:example of None object and or operator #this code is created by Rezaul Hoque on May 01,2022. #contact:jewelmrh@yahoo.com;Dhaka,Bangladesh;https://rezaulhoque.wordpress.com,https://hoquestake.blogspot.com #note: codes shared by Rezaul Hoque on rextester are not for sale; they are created and shared to facilitate the algorithm learning process; many like Hoque use this platform to practice programming ;Rezaul hopes his contribution helps others to fine tune their learning; #this program tries to print total payment an executive receives based on his weekly sales; if total weekly sales is above TK 1000, he receives TK 1000 plus 20% commission on his total weekly sales; if weekly sales is between below TK 1000 and TK 100,he receives TK1000; sales below TK 100 earns him nothing; def pay(arr=None): if arr is None: arr=[ ] total=sum(arr) if total>=100: if total >1000: return 1000+total*0.20 return 1000 or 0 #return 0 if __name__=='__main__': a=[100,200,300,500] show=pay(a) or 0 print(show)
[
+
]
Show input
Absolute running time: 0.15 sec, cpu time: 0.02 sec, memory peak: 8 Mb, absolute service time: 0,21 sec
edit mode
|
history
|
discussion
1220.0