File tree 4 files changed +107
-0
lines changed
4 files changed +107
-0
lines changed Original file line number Diff line number Diff line change
1
+ print (
2
+ '-----------------------------------------\n ' \
3
+ 'Practical python education || Exercise-3:\n ' \
4
+ '-----------------------------------------\n '
5
+ )
6
+
7
+ print (
8
+ 'Task:\n ' \
9
+ '-----------------------------------------\n ' \
10
+ 'Write a Python program to display the current date and time."\n '
11
+ )
12
+
13
+ print (
14
+ 'Solution:\n ' \
15
+ '-----------------------------------------' \
16
+ )
17
+
18
+ import datetime ;
19
+ now = datetime .datetime .now ()
20
+ print ("Current date and time :" )
21
+ print (now .strftime ("%Y-%m-%d %H:%M:%S" ))
22
+
23
+ print (
24
+ '\n -----------------------------------------\n ' \
25
+ 'Copyright 2018 Vladimir Pavlov. All Rights Reserved.\n ' \
26
+ '-----------------------------------------'
27
+ )
Original file line number Diff line number Diff line change
1
+ print (
2
+ '-----------------------------------------\n ' \
3
+ 'Practical python education || Exercise-4:\n ' \
4
+ '-----------------------------------------\n '
5
+ )
6
+
7
+ print (
8
+ 'Task:\n ' \
9
+ '-----------------------------------------\n ' \
10
+ 'Write a Python program which accepts the radius of a circle from the user and compute the area:"\n '
11
+ )
12
+
13
+ print (
14
+ 'Solution:\n ' \
15
+ '-----------------------------------------' \
16
+ )
17
+
18
+ from math import pi
19
+ r = float (input ("R = " ))
20
+ print ("S = piR^2 = pi" + str (r ) + "^2 = " + str (pi * r ** 2 ))
21
+
22
+ print (
23
+ '\n -----------------------------------------\n ' \
24
+ 'Copyright 2018 Vladimir Pavlov. All Rights Reserved.\n ' \
25
+ '-----------------------------------------'
26
+ )
Original file line number Diff line number Diff line change
1
+ print (
2
+ '-----------------------------------------\n ' \
3
+ 'Practical python education || Exercise-5:\n ' \
4
+ '-----------------------------------------\n '
5
+ )
6
+
7
+ print (
8
+ 'Task:\n ' \
9
+ '-----------------------------------------\n ' \
10
+ 'Write a Python program which accepts the user\' s first and last name and print them in reverse order with a space between them:\n '
11
+ )
12
+
13
+ print (
14
+ 'Solution:\n ' \
15
+ '-----------------------------------------' \
16
+ )
17
+
18
+ f_name = str (input ("First name: " ))
19
+ l_name = str (input ("Last name: " ))
20
+ print (l_name + ' ' + f_name )
21
+
22
+ print (
23
+ '\n -----------------------------------------\n ' \
24
+ 'Copyright 2018 Vladimir Pavlov. All Rights Reserved.\n ' \
25
+ '-----------------------------------------'
26
+ )
Original file line number Diff line number Diff line change
1
+ print (
2
+ '-----------------------------------------\n ' \
3
+ 'Practical python education || Exercise-6:\n ' \
4
+ '-----------------------------------------\n '
5
+ )
6
+
7
+ print (
8
+ 'Task:\n ' \
9
+ '-----------------------------------------\n ' \
10
+ 'Write a Python program which accepts a sequence of comma-separated numbers from user and generate a list and a tuple with those numbers.\n '
11
+ )
12
+
13
+ print (
14
+ 'Solution:\n ' \
15
+ '-----------------------------------------' \
16
+ )
17
+
18
+ values = input ("Input some comma separated numbers : " )
19
+ list = values .split (',' )
20
+ tuple = tuple (list )
21
+ print ('List : ' , list )
22
+ print ('Tuple : ' , tuple )
23
+
24
+ print (
25
+ '\n -----------------------------------------\n ' \
26
+ 'Copyright 2018 Vladimir Pavlov. All Rights Reserved.\n ' \
27
+ '-----------------------------------------'
28
+ )
You can’t perform that action at this time.
0 commit comments