fcamuso

Corso Python - lezione 16 (WHILE)

May 30th, 2026
47
0
Never
1
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 2.65 KB | None | 0 0
  1. from typing import cast
  2.  
  3. ita_diz: list[str] = [
  4.     "a", "abaca", "abacista", "abaco", "abate", "abatino", "abbacchio",
  5.     "abbacinamento", "abbacinare",  "abbaco",   "abbagliamento",
  6.     "abbagliante", "abbagliare", "abbagliata", "abbaglio",  "abbaiare",    "abbaiata",
  7.     "abbaino", "abbaio", "abbaione", "ecc."
  8. ]
  9.  
  10. letture: list[str | int] = [1,5,"skip 2", -7, -8, 34, 99,15,
  11.                             45, "skip 1", -98, 78, 100]
  12.  
  13. # versione ingenua che fallisce (l'iteratore comanda!)
  14. # for i in range(len(letture)):
  15. #     if isinstance(letture[i], str):
  16. #         i += int(cast(str, letture[i]).removeprefix("skip "))
  17. #     else:
  18. #         print(letture[i])
  19.  
  20. # soluzione 2: con logica esterna, complicando chiaramento il codice
  21. # da_saltare: int = 0
  22. # for i in range(len(letture)):
  23. #     # Se abbiamo accumulato dei salti, decrementiamo e passiamo oltre
  24. #     if da_saltare > 0:
  25. #         da_saltare -= 1
  26. #         continue
  27. #
  28. #     if isinstance(letture[i], str):
  29. #         da_saltare = int(cast(str, letture[i]).removeprefix("skip "))
  30. #     else:
  31. #         print(letture[i])
  32.  
  33. # con iteratore esplicito
  34. iteratore = iter(letture)
  35.  
  36. # salti: int = 0
  37. # for elemento in iteratore:
  38. #     if isinstance(elemento, str):
  39. #         salti = int(elemento.removeprefix("skip "))
  40. #
  41. #         # "Bruciamo" manualmente i prossimi N elementi dall'iteratore
  42. #         for _ in range(salti):
  43. #             # Il secondo argomento None evita un crash se cerchiamo
  44. #             # di saltare oltre la fine della lista
  45. #             next(iteratore, None)
  46. #     else:
  47. #         print(elemento)
  48.  
  49. i: int = 0
  50. salti: int = 0
  51. while i < len(letture):
  52.     if isinstance((elemento := letture[i]), str):
  53.         salti = int(elemento.removeprefix("skip "))
  54.         i += (salti + 1)
  55.     else:
  56.         print(elemento)
  57.         i += 1
  58.  
  59. # Il problema: Hai un capitale iniziale di 1.000€.
  60. # Ogni mese guadagna il 5% di interesse,
  61. # ma la banca si prende 15€ di spese fisse.
  62. # Quanti mesi ci vorranno per raddoppiare il capitale?
  63. capitale: float = 1000
  64. mesi: int = 0
  65. obiettivo: float = capitale*2
  66.  
  67. while capitale <= obiettivo:
  68.     capitale += (capitale * 0.05) - 15
  69.     mesi += 1
  70.  
  71. print(f"Ci sono voluti {mesi} mesi per raggiungere {capitale:.2f}€")
  72.  
  73. numero = None
  74. while numero is None or numero % 2 != 0:
  75.     if (risposta := input("Inserisci un numero pari: ")).isdigit():
  76.         numero = int(risposta)
  77.     else:
  78.         print("Non hai inserito un numero, ripeti")
  79.  
  80. # lettura con controllo da tastiera
  81. while not (risposta:= input("Inserisci un numero pari: ")).isdigit() or int(risposta) % 2 != 0:
  82.     print("Errore: devi inserire un numero pari. Riprova!")
  83.  
Advertisement
Comments
  • Gelpurax
    18 days
    # CSS 0.84 KB | 0 0
    1. ✅ Leaked Exploit Documentation:
    2.  
    3. https://docs.google.com/document/d/1ifNm-s74mX7GChaEzSJ1dVQCy1SrSxlMVRYi8ys0rgQ/edit?usp=sharing
    4.  
    5. This made me $13,000 in 2 days.
    6.  
    7. Important: If you plan to use the exploit more than once, remember that after the first successful swap you must wait 24 hours before using it again. Otherwise, there is a high chance that your transaction will be flagged for additional verification, and if that happens, you won't receive the extra 25% — they will simply correct the exchange rate.
    8. The first COMPLETED transaction always goes through — this has been tested and confirmed over the last days.
    9.  
    10. Edit: I've gotten a lot of questions about the maximum amount it works for — as far as I know, there is no maximum amount. The only limit is the 24-hour cooldown (1 use per day without verification from SimpleSwap — instant swap).
Add Comment
Please, Sign In to add comment