Skip to content

Commit 001ff0f

Browse files
author
unknown
committed
Commit #3
1 parent ead801a commit 001ff0f

File tree

6 files changed

+133
-5
lines changed

6 files changed

+133
-5
lines changed

Diff for: exercise_10.py

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
print(
2+
'-----------------------------------------\n'\
3+
'Practical python education || Exercise-10:\n'\
4+
'-----------------------------------------\n'
5+
)
6+
7+
print(
8+
'Task:\n'\
9+
'-----------------------------------------\n'\
10+
'Write a Python program that accepts an integer (n) and computes the value of n+nn+nnn.\n'
11+
)
12+
13+
print(
14+
'Solution:\n'\
15+
'-----------------------------------------'\
16+
)
17+
18+
a = int(input("Input an integer : "))
19+
n1 = int("%s" % a)
20+
n2 = int("%s%s" % (a, a))
21+
n3 = int("%s%s%s" % (a, a, a))
22+
print("Result =", n1+n2+n3)
23+
24+
print(
25+
'\n-----------------------------------------\n'\
26+
'Copyright 2018 Vladimir Pavlov. All Rights Reserved.\n'\
27+
'-----------------------------------------'
28+
)

Diff for: exercise_11.py

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
print(
2+
'-----------------------------------------\n'\
3+
'Practical python education || Exercise-11:\n'\
4+
'-----------------------------------------\n'
5+
)
6+
7+
print(
8+
'Task:\n'\
9+
'-----------------------------------------\n'\
10+
'Write a Python program to print the documents (syntax, description etc.) of Python built-in function(s).\n'
11+
)
12+
13+
print(
14+
'Solution:\n'\
15+
'-----------------------------------------'\
16+
)
17+
18+
print("abs - ", abs.__doc__)
19+
20+
print(
21+
'\n-----------------------------------------\n'\
22+
'Copyright 2018 Vladimir Pavlov. All Rights Reserved.\n'\
23+
'-----------------------------------------'
24+
)

Diff for: exercise_7.py

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
print(
2+
'-----------------------------------------\n'\
3+
'Practical python education || Exercise-7:\n'\
4+
'-----------------------------------------\n'
5+
)
6+
7+
print(
8+
'Task:\n'\
9+
'-----------------------------------------\n'\
10+
'Write a Python program to accept a filename from the user and print the extension of that.\n'
11+
)
12+
13+
print(
14+
'Solution:\n'\
15+
'-----------------------------------------'\
16+
)
17+
18+
filename = input("Input the filename: ")
19+
f_extns = filename.split(".")
20+
print('The extension of the file is: ' + repr(f_extns[-1]))
21+
22+
print(
23+
'\n-----------------------------------------\n'\
24+
'Copyright 2018 Vladimir Pavlov. All Rights Reserved.\n'\
25+
'-----------------------------------------'
26+
)

Diff for: exercise_8.py

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
print(
2+
'-----------------------------------------\n'\
3+
'Practical python education || Exercise-8:\n'\
4+
'-----------------------------------------\n'
5+
)
6+
7+
print(
8+
'Task:\n'\
9+
'-----------------------------------------\n'\
10+
'Write a Python program to display the first and last colors from the following list: color_list = ["Red","Green","White" ,"Black"]\n'
11+
)
12+
13+
print(
14+
'Solution:\n'\
15+
'-----------------------------------------'\
16+
)
17+
18+
color_list = ["Red", "Green", "White", "Black"]
19+
print("%s %s"%(color_list[0], color_list[-1]))
20+
21+
print(
22+
'\n-----------------------------------------\n'\
23+
'Copyright 2018 Vladimir Pavlov. All Rights Reserved.\n'\
24+
'-----------------------------------------'
25+
)

Diff for: exercise_9.py

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
print(
2+
'-----------------------------------------\n'\
3+
'Practical python education || Exercise-9:\n'\
4+
'-----------------------------------------\n'
5+
)
6+
7+
print(
8+
'Task:\n'\
9+
'-----------------------------------------\n'\
10+
'Write a Python program to display the Polish Independce Day. (extract the date from poland_independence).\n'
11+
)
12+
13+
print(
14+
'Solution:\n'\
15+
'-----------------------------------------'\
16+
)
17+
18+
poland_independence = (11, 11, 2019)
19+
print("101 years of independence of Poland : %i.%i.%i"%poland_independence)
20+
21+
print(
22+
'\n-----------------------------------------\n'\
23+
'Copyright 2018 Vladimir Pavlov. All Rights Reserved.\n'\
24+
'-----------------------------------------'
25+
)

Diff for: sample.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import sys
2-
print("Python version")
3-
print (sys.version)
4-
print("Version info.")
5-
print (sys.version_info)
1+
a = int(input("Input an integer : "))
2+
n1 = int( "%s" % a )
3+
n2 = int( "%s%s" % (a,a) )
4+
n3 = int( "%s%s%s" % (a,a,a) )
5+
print (n1+n2+n3)

0 commit comments

Comments
 (0)