Skip to content
Snippets Groups Projects
Commit 4aa2cdcb authored by cprutean's avatar cprutean
Browse files

Upload New File

parent c83e7cf7
No related branches found
No related tags found
No related merge requests found
%% Cell type:markdown id:e477673e tags:
# Three Way Conditional
%% Cell type:code id:d0274b5d tags:
``` python
"""
Three way conditional example
"""
import math
def main():
a = float(input("Give a float : "))
if a > 4.0 :
# Inside if
b = 4.0 - math.sqrt(a)
a = 2.0*(b - 3.0)
print("if statements executed")
elif a > 0 :
# Inside else is
b = 1.0 + math.sqrt(a)
a = (b - 1.0)
print("elif statements executed")
else :
# Inside else
b = 4.0 - 3.0*math.sqrt(-a)
a = 7.0*(b - 3.0)
print("else statements executed")
# Outside conditional
print("The value of a is : " + str(a) + " and b is : " + str(b))
main()
```
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment