Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis0
Title Encoder Python
ŠæŠøŃŃ Š»ŃŠ±ŃŠµ ŃŠµŃŠµŠ½ŠøŃ(ŠøŠ· ŠøŠ½ŠµŃŠ°) Šø ŠæŠ¾ŃŃŠ¾ŃŠ½Š½Š¾ Š¾ŃŠøŠ±ŠŗŠ°. ŃŃŠ¾ Š½Šµ ŃŠ°Šŗ? Š½ŃŠ¶Š½Š¾ ŃŠ“ŠµŠ»Š°ŃŃ For example, for the book title "Game of Thrones" the encoded version should be "GoT". file = open("/usercode/files/books.txt", "r") #your code goes here file.close()
4 Respostas
+ 1
file = open("/usercode/files/books.txt", "r")
for line in file:
words = line.split()
i = ""
for word in words:
i += word[0]
print(i)
file.close()
0
t = "Game of Thrones"
for w in t.split(): print (w[0], end="")
0
file = open("/usercode/files/books.txt", "r")
#your code goes here
rl = file.readlines()
for r in rl:
for w in r.split(): print (w[0], end="")
print()
file.close()
https://www.sololearn.com/compiler-playground/c7XcuKuF2B6Y
0
file = open("/usercode/files/books.txt", "r")
#your code goes here
for x in file:
title=x.split()
for a in title:
print(a[0],end='')
print()
file.close()