Corretti script per supportare Python 3 nativamente contenuto in Raspbian.
This commit is contained in:
parent
ac4e82d2c2
commit
2ea3347729
3 changed files with 9 additions and 3 deletions
4
cifra.py
4
cifra.py
|
@ -11,7 +11,7 @@ def cifra(testo, rotazione = 5):
|
|||
continue
|
||||
indice_c = string.ascii_uppercase.index(i)
|
||||
parziale = indice_c + rotazione
|
||||
if parziale > len(string.ascii_uppercase):
|
||||
if parziale >= len(string.ascii_uppercase):
|
||||
parziale = parziale % len(string.ascii_uppercase)
|
||||
|
||||
risultato += string.ascii_uppercase[parziale]
|
||||
|
@ -19,4 +19,4 @@ def cifra(testo, rotazione = 5):
|
|||
return risultato
|
||||
|
||||
if __name__ == '__main__':
|
||||
print cifra(sys.argv[1].upper(), 5)
|
||||
print(cifra(sys.argv[1].upper(), 5))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue