-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathalien.py
More file actions
39 lines (29 loc) · 936 Bytes
/
alien.py
File metadata and controls
39 lines (29 loc) · 936 Bytes
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
# -*- coding: utf-8 -*-
"""
Created on Fri Jan 11 13:39:32 2019
@author: Nishant Ghanate
"""
# your code goes here
import pandas as pd
#Take User input for alphabetical order and string
#a= input('Enter the order of alphabet : \n')
#b= input('Enter the string you want to sort according to the Alphabet provided : \n')
a = "abcdefghijklmnopqrstuvwxyz"
b = "cyxbza"
df = []
#Combining both list to a new list
for i,j in zip(list(a),list(a.upper())):
df.append(j)
df.append(i)
#print(df)
a=df
#Converting list to the dataframe
alphabet = pd.DataFrame(index=range(0,len(a)),columns=['letter'])
spell = pd.DataFrame(index=range(0,len(b)),columns=['letter'])
alphabet['letter'] = list(a)
spell['letter'] = list(b)
#Sorting of String according to alphabet as per condition provided
alphabet=pd.merge(alphabet,spell,how='inner')
##Printing the final result
#output = ''.join(alphabet['letter'].values.tolist())
#print(output)