This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
M = input() | |
M1, M2, M3 = int(M[-3]),int(M[-2]),int(M[-1]) | |
M1M3=M1*10+M3 | |
M1M2=M1*10+M2 | |
M2M3=M2*10+M3 | |
M2M1=M2*10+M1 | |
M3M1=M3*10+M1 | |
M3M2=M3*10+M2 | |
print(M1, M2, M3) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def fatorial(n): | |
resultado = 1 | |
for i in range(2, n+1): | |
resultado = resultado * i | |
return resultado | |
a = int(input("Digite um número")) | |
print("O fatorial de", a, "é", fatorial(a)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Append | |
#a = [1, 2, 4, 8] | |
#a.append(16) | |
#print(a) #[1, 2, 4, 8, 16] | |
#b = [] | |
#for i in range(10): | |
# x = int(input()) | |
# b.append(x) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Listas | |
# Lista literal | |
lista = list(map(int, input("Digite os numeros:").split())) | |
maior = lista[0] | |
menor = lista[0] | |
soma = 0 | |
for x in lista: | |
print(x) | |
if x > maior: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import random | |
numero = random.randint(1, 100) | |
print("Escolhi um numero entre 1 e 1000.") | |
print("Tente descobrir.") | |
palpite = int(input("Qual o seu palpite?")) | |
contador = 1 | |
while palpite != numero: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.io.IOException; | |
import org.antlr.v4.runtime.ANTLRInputStream; | |
import org.antlr.v4.runtime.CommonTokenStream; | |
import org.antlr.v4.runtime.tree.ParseTree; | |
import org.antlr.v4.runtime.tree.ParseTreeWalker; | |
public class Principal { | |
private static ParseTree parse(String programa) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Main { | |
public static void main(String[] args) { | |
System.out.println("Hello world!"); | |
String s = "abc"; | |
StringBuilder sb = new StringBuilder("`"); | |
for(char c: s.toCharArray()){ | |
sb.append(String.format("\\u%04X", (int)c)); | |
} | |
sb.append('`'); | |
System.out.println(sb.toString()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//------------ GENERATOR ------------------ | |
def fill(px: Int, py: Int)(word: String): Unit = { | |
var (x, y) = ind(px, py)(word) | |
for ((c, i) <- word.zipWithIndex) { | |
matrix(x + px * i)(y + py * i) = c | |
} | |
} | |
def ind(px: Int, py: Int)(word: String): (Int, Int) = { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Usando a linguagem Potigol: potigol.github.io | |
palindromos(min, max: Inteiro) = | |
para i de min até max se i.texto == i.texto.inverta gere i fim | |
testes = [(0, 20), (3000, 3010), (0, 1000), (1000, 2000), (2000, 3000)] | |
para teste em testes faça | |
min, max = teste.primeiro, teste.segundo | |
escreva "{min} - {max}: {palindromos(min, max).junte(", ")} | |
|==========" |