Skip to content

Commit a847f9e

Browse files
committed
inital examples
1 parent bdb2d10 commit a847f9e

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

add_two_numbers.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import random
2+
a= input("Enter a no of your choice")
3+
b= input("Enter a second no of your choice")
4+
sum = a+b
5+
print('The sum of two numbers is {}'.format(sum) )
6+
7+
8+
#square root of user input number.
9+
square_root= a**0.5
10+
print('The square root of {} is {}'.format(a, square_root) )
11+
12+
#generate random number
13+
c= random.randint(1, 100)
14+
print('A random number in range of 1 to 100 is {}'.format(c))
15+
16+
#check prime number or not, we're checking b here.
17+
for i in range (2,b-1,1):
18+
if ( b%i==0):
19+
print('The number {} is not prime'.format(b))
20+
break
21+
else:
22+
print('Prime Number')
23+
break
24+
25+
#
26+
27+

0 commit comments

Comments
 (0)