-
Notifications
You must be signed in to change notification settings - Fork 0
/
chap 1_11.py
65 lines (47 loc) · 1.14 KB
/
chap 1_11.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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# chapter 1-11 and assignment no. 1
import sys
import math
import datetime
# print
msg = "My Name is Talha"
print(msg)
# Numbers
number = 123456
number += 1
print(number)
concatination = "19" + "97"
print(concatination)
# Bodmas rules
num = 4 * 8 / 2 + 10 # Division single / show result in point(.) & double not show point(.)
print(num)
# Concatenating strings
firstName = "Talha"
lastName = "Javed"
fullName = firstName + ' ' + lastName
print(fullName)
greeting = "Hello"
space = " "
address = "World"
separators = "!"
whole_greeting = greeting + space + address + separators
print(whole_greeting)
# if else statment
if ('hello' == 'hello'):
print('condition true')
else:
print('condition false')
if (2 > 2):
print("Talha")
elif ('python' == 'javaScript'):
print("elif ")
else:
print("else")
# assignment no. 1
pythonVarsion = "Python version: " + sys.version
print (pythonVarsion)
print ("Version information: ")
print (sys.version_info)
now = datetime.datetime.now()
print(now)
r = float(input ("Input the radius of the circle : "))
print ("The area of the circle with radius " + str(r) + " is: " + str(math.pi * r**2))