+ 1

Please I need a code to develop multiplication table and currency converter in puthon

multiplication table and currency converter

23rd Jun 2018, 10:47 PM
Dejih Ramadan
Dejih Ramadan - avatar
29 odpowiedzi
+ 1
import pprint n = 12 m = list(list(range(1*i, (n+1)*i, i)) for i in range(1, n+1)) pprint.pprint(m) [[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12], [2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24], [3, 6, 9, 12, 15, 18, 21, 24, 27, 30, 33, 36], [4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44, 48], [5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60], [6, 12, 18, 24, 30, 36, 42, 48, 54, 60, 66, 72], [7, 14, 21, 28, 35, 42, 49, 56, 63, 70, 77, 84], [8, 16, 24, 32, 40, 48, 56, 64, 72, 80, 88, 96], [9, 18, 27, 36, 45, 54, 63, 72, 81, 90, 99, 108], [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120], [11, 22, 33, 44, 55, 66, 77, 88, 99, 110, 121, 132], [12, 24, 36, 48, 60, 72, 84, 96, 108, 120, 132, 144]]
23rd Jun 2018, 11:06 PM
Paswer World
Paswer World - avatar
+ 1
max_width = len(str(m[-1][-1])) + 1 for i in m: i = [str (j).rjust(max_width) for j in i] print (".join(i)) 1 2 3 4 5 6 7 8 9 10 11 12 2 4 6 8 10 12 14 16 18 20 22 24 3 6 9 12 15 18 21 24 27 30 33 36 4 8 12 16 20 24 28 32 36 40 44 48 5 10 15 20 25 30 35 40 45 50 55 60 6 12 18 24 30 36 42 48 54 60 66 72 7 14 21 28 35 42 49 56 63 70 77 84 8 16 24 32 40 48 56 64 72 80 88 96 9 18 27 36 45 54 63 72 81 90 99 108 10 20 30 40 50 60 70 80 90 100 110 120 11 22 33 44 55 66 77 88 99 110 121 132 12 24 36 48 60 72 84 96 108 120 132 144
23rd Jun 2018, 11:08 PM
Paswer World
Paswer World - avatar
+ 1
I see, I just want you to be my mentor. show me steps and advice on what to do to develop my self
23rd Jun 2018, 11:47 PM
Dejih Ramadan
Dejih Ramadan - avatar
+ 1
wow! I get it would have love to pay for your service which am doubtful of because you are a pro and am still in school
23rd Jun 2018, 11:53 PM
Dejih Ramadan
Dejih Ramadan - avatar
+ 1
Russia! that's nice hope you are enjoying the world cup. anyway I really appreciate you, thanks a million
24th Jun 2018, 12:06 AM
Dejih Ramadan
Dejih Ramadan - avatar
0
Specify the language in which you want this table to be written
23rd Jun 2018, 10:51 PM
Paswer World
Paswer World - avatar
0
Thanks sir. am just learning python. so I will love you to help me in python language
23rd Jun 2018, 10:52 PM
Dejih Ramadan
Dejih Ramadan - avatar
0
Now that we have the list of integers that is in the form that we want, we have to convert them to strings that are correctly justified with a width from one greater than the largest integer in the list of lists (the last integer) using the default argument '' for fillchar.
23rd Jun 2018, 11:08 PM
Paswer World
Paswer World - avatar
0
and demonstrate the elasticity of the interval with a different size, for example. n = 9
23rd Jun 2018, 11:09 PM
Paswer World
Paswer World - avatar
0
n=9 m = list(list(range(1*i,(n+1)*i, i)) for i in range(1,n+1)) for i in m: i = [str(j).rjust(len(str(m[-1][-1]))+1) for j in i] print(''.join(i)) 1 2 3 4 5 6 7 8 9 2 4 6 8 10 12 14 16 18 3 6 9 12 15 18 21 24 27 4 8 12 16 20 24 28 32 36 5 10 15 20 25 30 35 40 45 6 12 18 24 30 36 42 48 54 7 14 21 28 35 42 49 56 63 8 16 24 32 40 48 56 64 72 9 18 27 36 45 54 63 72 81
23rd Jun 2018, 11:09 PM
Paswer World
Paswer World - avatar
0
Thanks Paswer. I really appreciate
23rd Jun 2018, 11:09 PM
Dejih Ramadan
Dejih Ramadan - avatar
0
Also procedure for converting from one currency to another using python
23rd Jun 2018, 11:11 PM
Dejih Ramadan
Dejih Ramadan - avatar
0
Well, I don't need to be rushed.
23rd Jun 2018, 11:13 PM
Paswer World
Paswer World - avatar
0
Thanks. I don't mean to rush you. I will appreciate you spare time sir
23rd Jun 2018, 11:16 PM
Dejih Ramadan
Dejih Ramadan - avatar
0
I con see you are really do at this
23rd Jun 2018, 11:16 PM
Dejih Ramadan
Dejih Ramadan - avatar
0
You can use the vectorized str methods to replace unwanted characters and then apply the type to the int:
23rd Jun 2018, 11:19 PM
Paswer World
Paswer World - avatar
0
In [81]: df[df.columns[1:]] = df[df.columns[1:]].apply(lambda x: x.str.replace('
#x27;,'')).apply(lambda x: x.str.replace(',','')).astype(np.int64) df Out[81]: state 1st 2nd 3rd index 0 California 11593820 109264246 8496273 1 New York 10861680 45336041 6317300 2 Florida 7942848 69369589 4697244 3 Texas 7536817 61830712 5736941 dtype теперь подтверждено изменение: In [82]: df.info() <class 'pandas.core.frame.DataFrame'> Int64Index: 4 entries, 0 to 3 Data columns (total 4 columns): state 4 non-null object 1st 4 non-null int64 2nd 4 non-null int64 3rd 4 non-null int64 dtypes: int64(3), object(1) memory usage: 160.0+ bytes
23rd Jun 2018, 11:19 PM
Paswer World
Paswer World - avatar
0
dtype change now confirmed:
23rd Jun 2018, 11:20 PM
Paswer World
Paswer World - avatar
0
In [82]: df.info() <class 'pandas.core.frame.DataFrame'> Int64Index: 4 entries, 0 to 3 Data columns (total 4 columns): state 4 non-null object 1st 4 non-null int64 2nd 4 non-null int64 3rd 4 non-null int64 dtypes: int64(3), object(1) memory usage: 160.0+ bytes
23rd Jun 2018, 11:20 PM
Paswer World
Paswer World - avatar
0
Other way:
23rd Jun 2018, 11:20 PM
Paswer World
Paswer World - avatar