Sololearn: Learn to Code
New course! Every coder should learn Generative AI!
Try a free lesson
+ 10
U14known , since the input is just a number, or a a number with 2 leading *HYPHEN MINUS*, i don't think that we need to use regex. it could be done like: https://code.sololearn.com/c0uzsPoW7Ie0/?ref=app
30th Nov 2022, 3:04 PM
Lothar
Lothar - avatar
+ 6
mmaos QQQ , to create a new question you can do: > go to the *create section* (bottom of page) > select *discuss* (top of page) > click *+ new post* button
2nd Dec 2022, 12:38 PM
Lothar
Lothar - avatar
+ 5
U14known , Lochard , i have added also a version to the code in my first post that can handle multiple inputs of numbers.
2nd Dec 2022, 12:56 PM
Lothar
Lothar - avatar
+ 4
U14known , pease make an input sample and what you are expecting as output.
30th Nov 2022, 10:38 AM
Lothar
Lothar - avatar
+ 4
U14known , the "--" that you have use are 2 *HYPHEN MINUS* (unicode id / ascii 45). is this what you have meant?
30th Nov 2022, 10:58 AM
Lothar
Lothar - avatar
+ 3
U14known , I improved your code a bit I hope this is what you wanted import re, string letter=list(string.ascii_lowercase) str_in = input() cap = str_in[:2] == "--" sp = int(re.findall(r"\d+",str_in)[0])-1 if cap: print(letter[sp].upper()) else: print(letter[sp]) https://code.sololearn.com/cncy8PiCii50
30th Nov 2022, 12:04 PM
SoloProg
SoloProg - avatar
+ 2
https://code.sololearn.com/cB7wkbqOzyqZ/?ref=app
2nd Dec 2022, 6:38 AM
Lochard
Lochard - avatar
+ 1
The output is a list of int though. https://code.sololearn.com/cLe5suunzki8/?ref=app
30th Nov 2022, 11:05 AM
Lochard
Lochard - avatar
0
How to add question? I can not see button to add that
1st Dec 2022, 10:25 PM
balanceparis
balanceparis - avatar
0
Input 12
2nd Dec 2022, 10:24 AM
Gift Mulubwa
Gift Mulubwa - avatar