-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path26.py
34 lines (30 loc) · 1.28 KB
/
26.py
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
# Write a Python program that will ask the user to input a string (containing exactly one
# word). Then print the ASCII code for each character in the String using the ord( ) function.
# Sample Input Sample Output
# quincuncial q: 113
# u: 117
# i: 105
# n: 110
# c: 99
# u: 117
# n: 110
# c: 99
# i: 105
# a: 97
# l: 108
inp = input("Enter Input: ")
for x in inp:
print(x+': '+str(ord(x)))
# Write a Python program that takes a String as input from the user, removes the characters
# at even index and prints the resulting String in uppercase.
# Sample Input Output
# String TIG
# abcd BD
inps = input("Enter Input: ")
for x in range(len(inps)):
if x % 2 != 0:
val = ord(inps[x])
if val >= 97 or val <= 122:
val -= 32
val2 = chr(val)
print(val2, end = '')