+ 4

Could this code have fewer lines of code? Like instructions of functional programming

https://code.sololearn.com/cl0osxPIATRs/?ref=app

20th Nov 2021, 2:23 PM
Frank Castro
Frank Castro - avatar
21 odpowiedzi
+ 5
Okay I give up, here is my 65 character code โ˜บ๏ธ: https://code.sololearn.com/ctZ8PeXzMZKH/?ref=app
26th Nov 2021, 10:28 AM
Solo
Solo - avatar
+ 6
RUSIRU import string a = input() l = string.ascii_lowercase+' ' for i in a.lower(): n = l.index(i) print(l[25 - n], end='') ๐Ÿ‘‡ import string l = string.ascii_lowercase+' ' for i in input().lower(): print(l[25 - l.index(i)], end='') ๐Ÿ‘‡ import string;l=string.ascii_lowercase+' ' for i in input().lower():print(l[25-l.index(i)],end='') ๐Ÿ‘‡ In one line, 99 characters ๐Ÿ‘๐Ÿ‘๐Ÿ‘๐Ÿ‘โ˜บ๏ธ: import string;l=string.ascii_lowercase+' ';print(''.join(l[25-l.index(i)]for i in input().lower()))
20th Nov 2021, 4:00 PM
Solo
Solo - avatar
+ 4
IN TWO LINES 1)a=' abcdefghijklmnopqrstuvwxyz ' 2)print(''.join([a[-a.index(i)-1] for i in input().lower()]))
20th Nov 2021, 3:48 PM
Prabhas Koya
20th Nov 2021, 6:36 PM
Brian
Brian - avatar
+ 4
๐Ÿ˜„๐Ÿ˜„ Vasiliy you have hooked me into a competition. Let my try another entry. Can you make it shorter than 83 characters? ๐Ÿ˜ https://code.sololearn.com/c13uSM1hmQxc/?ref=app
20th Nov 2021, 11:41 PM
Brian
Brian - avatar
+ 4
Vasiliy I still count 83. If you prefer 81, then count this please: https://code.sololearn.com/c72U1VozJNTf/?ref=app
21st Nov 2021, 12:21 AM
Brian
Brian - avatar
+ 3
Frank Castro alphabet='abcdefghijklm nopqrstuvwxyz' backwardAlphabet=alphabet[::-1] inputStr=input() result='' for letter in inputStr.lower(): indexLetter=alphabet.index(letter) result+=backwardAlphabet[indexLetter] print(result) ๐Ÿ‘‡ a='abcdefghijklm nopqrstuvwxyz' backwardAlphabet=a[::-1] result='' for l in input().lower(): i=a.index(l) result+=backwardAlphabet[i] print(result) ๐Ÿ‘‡ a='abcdefghijklm nopqrstuvwxyz' result='' for l in input().lower(): result+=a[::-1][a.index(l)] print(result) ๐Ÿ‘‡ In one line, 91 characters โ˜บ๏ธ: a='abcdefghijklm nopqrstuvwxyz';print(''.join(a[::-1][a.index(l)]for l in input().lower()))
20th Nov 2021, 3:40 PM
Solo
Solo - avatar
+ 3
Prabhas Koya in one line, 88 characters ๐Ÿ‘๐Ÿ‘๐Ÿ‘๐Ÿ‘๐Ÿ‘๐Ÿ‘โ˜บ๏ธ: a='abcdefghijklm nopqrstuvwxyz';print(''.join(a[-a.index(i)-1]for i in input().lower()))
20th Nov 2021, 9:39 PM
Solo
Solo - avatar
+ 1
Try this :) import string a = input() l = string.ascii_lowercase u = string.ascii_uppercase n = 0 for i in a: if i in l: n = l.index(i) print(l[25 - n], end="") elif i in u: n = u.index(i) print(l[25 - n], end="") elif i == " ": print(i, end="")
20th Nov 2021, 3:09 PM
Rusiru Rathmina
Rusiru Rathmina - avatar
20th Nov 2021, 3:23 PM
The future is now thanks to science
The future is now thanks to science - avatar
+ 1
Brian 95 characters๐Ÿ‘๐Ÿ‘๐Ÿ‘๐Ÿ‘โ˜บ๏ธ
20th Nov 2021, 9:51 PM
Solo
Solo - avatar
+ 1
Brian, not 83, 81 characters โ˜บ๏ธ ๐Ÿ‘๐Ÿ‘๐Ÿ‘๐Ÿ‘๐Ÿ‘๐Ÿ‘
20th Nov 2021, 11:50 PM
Solo
Solo - avatar
+ 1
๐Ÿ˜ณBrian, 78 char!!! โ˜บ๏ธ ๐Ÿ‘๐Ÿ‘๐Ÿ‘๐Ÿ‘๐Ÿ‘๐Ÿ‘
21st Nov 2021, 12:25 AM
Solo
Solo - avatar
+ 1
Brian, 68 char โ˜บ๏ธ
22nd Nov 2021, 6:24 AM
Solo
Solo - avatar
+ 1
Vasiliy I think 68 char is impossible. 72 is the best I can do: https://code.sololearn.com/cw26IHs68AZ7/?ref=app
22nd Nov 2021, 6:18 PM
Brian
Brian - avatar
+ 1
Brian, I have shortened the code to 65 characters!!! โ˜บ๏ธ
25th Nov 2021, 3:30 AM
Solo
Solo - avatar
+ 1
For some reason I am not allowed to do this, it looks like I went beyond the bounds of what is permitted ๐Ÿคฃ๐Ÿคฃ๐Ÿคฃ And it all started with this discussion. Now I canโ€™t even share the html code in discussions, I asked a question about this, but so far thereโ€™s silence.
25th Nov 2021, 7:24 AM
Solo
Solo - avatar
+ 1
Wow Vasiliy using conditions in a new way.
26th Nov 2021, 4:41 PM
Prabhas Koya
+ 1
Prabhas Koya, I would not say that this is something new, just rare โ˜บ๏ธ
26th Nov 2021, 6:22 PM
Solo
Solo - avatar
+ 1
Vasiliy bravo!! ๐Ÿคฉ๐Ÿ‘๐Ÿ‘๐Ÿ‘๐Ÿ‘๐Ÿ‘๐Ÿค
26th Nov 2021, 8:47 PM
Brian
Brian - avatar