VisuAlg Web

Fatiando e Analisando Textos

Em Python, strings têm métodos poderosos como upper() , além de len() , find() e fatiamento [inicio:fim] .

Em Python, strings têm métodos poderosos como upper(), além de len(), find() e fatiamento [inicio:fim].

Exemplo de códigoPython


name = "joAo DA sIlvA"
print("System format: ", name.upper())  # JOAO DA SILVA
Exemplo de códigoPython


date_time = "25/12/2026 14:30"

print("The original string has ", len(date_time), " characters.")
print("The slash (/) is at position: ", date_time.find("/") + 1)

# Starts at position 1 (index 0) and takes 10 characters
date_only = date_time[0:10]
print("Isolated date: ", date_only)