Skip to content

Instantly share code, notes, and snippets.

View CarlosPereiraTI's full-sized avatar
🏠
Working from home

Charlie CarlosPereiraTI

🏠
Working from home
  • Canelones, Uruguay
View GitHub Profile
@CarlosPereiraTI
CarlosPereiraTI / reverse_a_string.py
Created April 7, 2023 11:47
How to reverse a string
"""
INVIRTIENDO CADENAS
Crea un programa que invierta el orden de una cadena de texto
sin usar funciones propias del lenguaje que lo hagan de forma automática.
- Si le pasamos "Hola mundo" nos retornaría "odnum aloH"
"""
def reverse(text):
text_len = len(text)
reversed_text = ""
@CarlosPereiraTI
CarlosPereiraTI / speed_test.py
Last active February 20, 2022 02:52
Internet speed test using Python
# pip install speedtest-cli
# upgrade pip if necessary "python -m pip install --upgrade pip"
import speedtest
# Speed test
speed_test = speedtest.Speedtest()
# Download Speed
download_speed = speed_test.download()
@CarlosPereiraTI
CarlosPereiraTI / bar_chart_3D.py
Created December 5, 2021 17:08
Bar char 3D using Python and openpyxl
# All rights: Mike Driscoll - Twitter: @driscollis
from openpyxl import Workbook, workbook
from openpyxl.chart import BarChart3D, Reference
def create_excel_data(sheet):
data_rows = [
["", "Kindle", "Paperback"],
["Python 101", 9.99, 25.99],
["Python 201 - Intermediate Python", 9.99, 25.99],
@CarlosPereiraTI
CarlosPereiraTI / keygen.py
Last active February 20, 2022 02:53
Key Generator
import random
ch = [1,2,3,4,5,6,7,8,9,0,'Q','W','E','R','T','Y','U','I','O','P','A','S','D','F','G','H','J','K','L','Z','X','C','V','B','N','M']
key = random.sample(ch,8)
password = ''.join(str(v) for v in key)
print(f"Password: {password}")
@CarlosPereiraTI
CarlosPereiraTI / try_except.py
Last active February 20, 2022 02:54
Python: While loop with try/except
user_input = ""
calculation_to_units = 24
def days_to_units(num_of_days):
return num_of_days * calculation_to_units
def validate_and_execute():
try:
user_input_number = int(user_input)