-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathExample2.py
35 lines (28 loc) · 938 Bytes
/
Example2.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
'''
Created on 10. 2. 2018
@author: Hanka
'''
import math
# Simple Example 1
print ("\nSimple Example 1")
print ("a" in "alpha") # return True
print ("b" in "python") # return False
print ("a" not in "python") # return True
print ("b" not in "baby") # return False
# Simple Example 2
print ("\nSimple Example 2")
number1 = int(input("Enter number1: "))
if (number1 > 5):
print ("Your number is greater than than 5.")
else:
print ("Your number is less than or equal to 5.")
# Simple Example 3
print ("\nSimple Example 3")
number2 = int(input("Enter number2 for calculation a square root: "))
if (number2 > 0):
print ("Your number is greater than 0.")
square_root = math.sqrt(number2)
print ("Square root %d is %.3f" %(number2, square_root))
else:
print ("Your number is less than or equal to 0.")
print ("The square root of a negative number does not exist.")