-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcreateDictFromTwoList.py
More file actions
102 lines (76 loc) · 1.69 KB
/
createDictFromTwoList.py
File metadata and controls
102 lines (76 loc) · 1.69 KB
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
# key = ['a', 'b', 'c']
# value = [1, 2, 3]
# dict ={}
# for k,v in zip(key, value):
# dict.update({k:v})
# print(dict)
# s= "Suraj Arya"
# for i in s:
# if i in dict:
# dict[i] += 1
# else:
# dict[i] = 1
# print(dict)
# s = "Banana"
# freq = {}
# for i in s:
# freq[i] = freq.get(i, 0) + 1
# print(freq)
# s = "Artificial Intelligence"
# s=s.lower()
# vowels = 0
# freq = {}
# for i in s:
# if i in 'aeiou':
# freq[i] = freq.get(i, 0) + 1
# vowels += 1
# print(vowels)
# print(freq)
# dict = {1: 'a', 2: 'b', 3: 'c', 4: 'd'}
# keys = list(dict.keys())
# values = list(dict.values())
# new_dict = {}
# for i in range(len(keys)):
# new_dict[values[i]] = keys[i]
# print(new_dict)
# temp = {}
# for k in dict:
# temp[dict[k]] = k
# print(temp)
# s = "Hello 43 % World"
# s = s.lower()
# vowels = 0
# cons = 0
# for i in s:
# if i.isalpha():
# if i in 'aeiou':
# vowels += 1
# else:
# cons += 1
# print(f"Vowels: {vowels}")
# print(f"Consonants: {cons}")
# num = 12345
# sum=0
# newnum = list(str(num))
# # print(newnum)
# for i in newnum:
# sum+= int(i)
# print(sum)
# # sum(int(i) for i in str(num))
# s = "This is a class of ml"
# splt = s.split()
# print(len(splt))
# s = "Suraj Arya 123#@"
# s = s.lower()
# new = ""
# for i in s:
# if i.isalpha() or i.isspace():
# new += i
# print(new)
# s1 = ' '.join(filter(str.isalpha, s))
# print(s1)
# s = "Hello In New World"
# s = s.lower()
# s = ' '.join(word[::-1] for word in s.split())
# print(s)
# find the longest word in a string