0
auto change input(output?)
I want a way to auto change the end result of https://code.sololearn.com/cENSWI6Pz81P/#py so A=0 B=1 C=2 etc.
12 Answers
+ 3
What does the number mean?
What is the intention of that piece of code?
You want each letter numbered by its position in the alphabet or something else?
+ 1
The output for this code Will become the input for a different code. The goal of this code is to change any input letter character number etc. into a purely numerical output, Which is required for the next code.
+ 1
Please discribe in brief
0
Not sure what you're asking
0
Can you elaborate
0
s = input()
#print(len(s))
x=0
y=3
while x<len(s):
print(s[x]+str(y))
if s[x]==" ":
y+=1
x=x+1
input=
test
output=
t3
e3
s3
t3
desired output=
19, 3
4, 3
18, 3
19, 3
or maybe
19,3
4,3
18,3
19,3
(no spaces)
or maybe
19 03
04 03
18 03
19 03
or maybe
19,03
04,03
18,03
19,03
or maybe
1903
0403
1803
1903
0
Something like this?
import string as st
s = list(input())
words=list((st.ascii_lowercase))
x=0
y=3
for i in s:
if i in words:
print (words.index(i)+1,y)
0
Almost, the original has an out put like this:
D3
o3
e3
s3
3
t4
h4
i4
s4
4
w5
o5
r5
k5
?5
your code:
15 3
5 3
19 3
20 3
8 3
9 3
19 3
23 3
15 3
18 3
11 3
and it doesn't account for non letters like "(space)" and "?" etc
0
Couldn't increment the value of y.
s = input()
x=0
y=3
for i in s:
c=list(i)
for i in c:
print(i,y)
0
PS C:\Users\steve\Google Drive\All\code\Code> & C:/Users/steve/AppData/Local/Programs/Python/Python38-32/python.exe "c:/Users/steve/Google Drive/All/code/Code/import string as st.py"
this is a test
t 3
h 3
i 3
s 3
3
i 3
s 3
3
a 3
3
t 3
e 3
s 3
t 3
PS C:\Users\steve\Google Drive\All\code\Code> if i in words:test
At line:1 char:7
+ if i in words:test
+ ~
Missing '(' after 'if' in if statement.
+ CategoryInfo : ParserError: (:) [], ParentContainsErrorRecordException
+ FullyQualifiedErrorId : MissingOpenParenthesisInIfStatement
0
if i could auto change input so that a always changes to 0, b always changes to 1 etc, that would have the Result i want, even if the code is kind of long.
0
I have "sort of" figured it out...but not really:
A=0
B=1
C=2
D=3
E=4
F=5
G=6
H=7
I=8
J=9
K=10
L=11
M=12
N=13
O=14
P=15
Q=16
R=17
S=18
T=19
U=20
V=21
W=22
X=23
Y=24
Z=25
a=0
b=1
c=2
d=3
e=4
f=5
g=6
h=7
i=8
j=9
k=10
l=11
m=12
n=13
o=14
p=15
q=16
r=17
s=18
t=19
u=20
v=21
w=22
x=23
y=24
z=25
input(A)
PS C:\Users\steve\Google Drive\All\code\Code> & C:/Users/steve/AppData/Local/Programs/Python/Python38-32/python.exe "c:/Users/steve/Google Drive/All/code/Code/input1 to input 2.py"
0
Unfortunately, I can't figure out how to integrate it into the existing code.