├── 07-CS50-CÓDIGO - SQL - MOVIE - 01
├── 07-CS50-CÓDIGO - SQL - MOVIE - 02
├── 06-CS50-CÓDIGO - PYTHON - OLÁ, PESSOA
├── 07-CS50-CÓDIGO - SQL - MOVIE - 04
├── 07-CS50-CÓDIGO - SQL - SONG1
├── 07-CS50-CÓDIGO - SQL - SONG5
├── 07-CS50-CÓDIGO - SQL - SONG8
├── 07-CS50-CÓDIGO - SQL - SONG2
├── 2022-03-mar-12-CERTIFICADO-CC50-Harvard.pdf
├── 07-CS50-CÓDIGO - SQL - MOVIE - 06
├── 07-CS50-CÓDIGO - SQL - MOVIE - 03
├── 07-CS50-CÓDIGO - SQL - SONG3
├── 07-CS50-CÓDIGO - SQL - SONG6
├── 07-CS50-CÓDIGO - SQL - MOVIE - 05
├── 07-CS50-CÓDIGO - SQL - SONG7
├── 07-CS50-CÓDIGO - SQL - SONG4
├── 07-CS50-CÓDIGO - SQL - MOVIE - 08
├── 06-CS50-CÓDIGO - PYTHON - MARIO1
├── 09-CS50-CÓDIGO - FLASK - FINANCE - HTML - quoted
├── 09-CS50-CÓDIGO - FLASK - FINANCE - requirements
├── 07-CS50-CÓDIGO - SQL - MOVIE - 10
├── 07-CS50-CÓDIGO - SQL - MOVIE - 09
├── 09-CS50-CÓDIGO - FLASK - FINANCE - HTML - apology
├── 07-CS50-CÓDIGO - SQL - MOVIE - 11
├── 07-CS50-CÓDIGO - SQL - MOVIE - 07
├── 07-CS50-CÓDIGO - SQL - MOVIE - 12
├── 07-CS50-CÓDIGO - SQL - MOVIE - 13
├── 08-CS50-CÓDIGO - HTML - TRIVIA - RESPOSTA2
├── 06-CS50-CÓDIGO - PYTHON - MARIO2
├── 09-CS50-CÓDIGO - FLASK - FINANCE - HTML - quote
├── 06-CS50-CÓDIGO - PYTHON - MOEDAS
├── 06-CS50-CÓDIGO - PYTHON - LEGIBILIDADE
├── 09-CS50-CÓDIGO - FLASK - FINANCE - HTML - buy
├── 09-CS50-CÓDIGO - FLASK - FINANCE - HTML - login
├── 01-CS50 - CÓDIGO MARIO - 1 PIRÂMIDE
├── 09-CS50-CÓDIGO - FLASK - FINANCE - HTML - history
├── 01-CS50 - CÓDIGO MÁRIO DUAS PÍRÂMIDES
├── 09-CS50-CÓDIGO - FLASK - FINANCE - HTML - sell
├── 09-CS50-CÓDIGO - FLASK - FINANCE - HTML - register
├── 08-CS50-CÓDIGO - HTML - TRIVIA - RESPOSTA1
├── 01-CS50 - CÓDIGO POPULAÇÃO
├── 08-CS50-CÓDIGO - HTML - INSTRAGAM
├── 01-CS50 - CÓDIGO DESAFIO MOEDA
├── 09-CS50-CÓDIGO - FLASK - BIRTHDAYS - APP.PY
├── 09-CS50-CÓDIGO - FLASK - FINANCE - styles
├── 08-CS50-CÓDIGO - HTML - MUSIC
├── 08-CS50-CÓDIGO - HTML - TRIVIA - RESPOSTA1 (correto)
├── 02-CS50-CÓDIGO - LEGIBILIDADE
├── 09-CS50-CÓDIGO - FLASK - FINANCE - HTML - index
├── 04-CS50-CÓDIGO - VOLUME
├── 06-CS50-CÓDIGO - PYTHON - CARTAO CREDITO
├── 08-CS50-CÓDIGO - HTML - INDEX - HOMEPAGE
├── 04-CS50-CÓDIGO - RECOVER
├── 02-CS50-CÓDIGO - CAESAR
├── 02-CS50-CÓDIGO - SCRABBLE
├── 06-CS50-CÓDIGO - PYTHON - COPA
├── 09-CS50-CÓDIGO - FLASK - FINANCE - helpers.py
├── 09-CS50-CÓDIGO - FLASK - BIRTHDAYS - INDEX.HTML
├── 09-CS50-CÓDIGO - FLASK - BIRTHDAYS - STYLES.CSS
├── 05-CS50-CÓDIGO - HERANCA
├── 03-CS50-CÓDIGO - PLURALITY
├── 06-CS50-CÓDIGO - PYTHON - DNA
├── 01-CS50 - CÓDIGO CARTÃO DE CRÉDITO
├── 02-CS50-CÓDIGO - SUBSTITUIÇÃO
├── 07-CS50-CÓDIGO - SQL - FIFTYVILLE
├── 08-CS50-CÓDIGO - HTML - TRIVIA - INDEX
├── 09-CS50-CÓDIGO - FLASK - FINANCE - HTML - layout
├── 03-CS50-CÓDIGO - TIDEMAN
├── 03-CS50-CÓDIGO - RUNOFF
├── 03-CS50-CÓDIGO - FILTRO 1
├── 04-CS50-CÓDIGO - FILTRO 1
└── 09-CS50-CÓDIGO - FLASK - application.py - FINANCE -
/07-CS50-CÓDIGO - SQL - MOVIE - 01:
--------------------------------------------------------------------------------
1 | --Listar filmes lançados em 2008 --
2 |
3 | SELECT title FROM movies WHERE year = 2008;
4 |
--------------------------------------------------------------------------------
/07-CS50-CÓDIGO - SQL - MOVIE - 02:
--------------------------------------------------------------------------------
1 | -- O ano de nascimento de Emma Stone --
2 |
3 | SELECT birth FROM people WHERE name = "Emma Stone";
4 |
--------------------------------------------------------------------------------
/06-CS50-CÓDIGO - PYTHON - OLÁ, PESSOA:
--------------------------------------------------------------------------------
1 | from cs50 import get_string
2 |
3 | answer = get_string("Qual o seu nome? ")
4 | print("Olá, " + answer)
5 |
--------------------------------------------------------------------------------
/07-CS50-CÓDIGO - SQL - MOVIE - 04:
--------------------------------------------------------------------------------
1 | -- Filmes com uma classificação IMDb de 10,0. --
2 |
3 | SELECT COUNT(movie_id) FROM ratings WHERE rating = 10,0;
4 |
--------------------------------------------------------------------------------
/07-CS50-CÓDIGO - SQL - SONG1:
--------------------------------------------------------------------------------
1 | -- sqlite3 songs.db --
2 | -- listar os nomes de todas as músicas no banco de dados --
3 |
4 | SELECT name FROM songs;
5 |
--------------------------------------------------------------------------------
/07-CS50-CÓDIGO - SQL - SONG5:
--------------------------------------------------------------------------------
1 | -- sqlite3 songs.db --
2 | -- retorne a energia média de todas as músicas --
3 |
4 | SELECT AVG(energy) FROM songs;
5 |
--------------------------------------------------------------------------------
/07-CS50-CÓDIGO - SQL - SONG8:
--------------------------------------------------------------------------------
1 | -- sqlite3 songs.db --
2 | -- lista os nomes das músicas que apresentam feat --
3 |
4 | SELECT name FROM songs WHERE name LIKE "%feat.%";
5 |
--------------------------------------------------------------------------------
/07-CS50-CÓDIGO - SQL - SONG2:
--------------------------------------------------------------------------------
1 | -- sqlite3 songs.db --
2 | -- listar os nomes de todas as músicas em ordem crescente de ritmo --
3 |
4 | SELECT name FROM songs ORDER BY tempo;
5 |
--------------------------------------------------------------------------------
/2022-03-mar-12-CERTIFICADO-CC50-Harvard.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rseneda/CC50-Introducao-Ciencia-Computacao-Harvard-Brasil/HEAD/2022-03-mar-12-CERTIFICADO-CC50-Harvard.pdf
--------------------------------------------------------------------------------
/07-CS50-CÓDIGO - SQL - MOVIE - 06:
--------------------------------------------------------------------------------
1 | -- Avaliação média de todos os filmes lançados em 2012 --
2 |
3 | SELECT AVG(rating) FROM ratings WHERE movie_id IN (SELECT id FROM movies WHERE year = 2012);
4 |
--------------------------------------------------------------------------------
/07-CS50-CÓDIGO - SQL - MOVIE - 03:
--------------------------------------------------------------------------------
1 | -- Listar filmes com data de lançamento igual ou posterior a 2018, em ordem alfabética --
2 |
3 | SELECT title FROM movies WHERE year >= 2018 ORDER BY UPPER(title);
4 |
--------------------------------------------------------------------------------
/07-CS50-CÓDIGO - SQL - SONG3:
--------------------------------------------------------------------------------
1 | -- sqlite3 songs.db --
2 | -- listar os nomes das 5 músicas mais longas, em ordem decrescente de duração --
3 |
4 | SELECT name FROM songs ORDER BY duration_ms DESC LIMIT 5;
5 |
--------------------------------------------------------------------------------
/07-CS50-CÓDIGO - SQL - SONG6:
--------------------------------------------------------------------------------
1 | -- sqlite3 songs.db --
2 | -- lista os nomes das músicas de Post Malone --
3 |
4 | SELECT name FROM songs WHERE artist_id = (SELECT id FROM artists where name = "Post Malone");
5 |
--------------------------------------------------------------------------------
/07-CS50-CÓDIGO - SQL - MOVIE - 05:
--------------------------------------------------------------------------------
1 | -- Títulos e anos de lançamento de todos os filmes de Harry Potter, em ordem cronológica --
2 |
3 | SELECT title, year FROM movies WHERE title LIKE "Harry Potter%" ORDER BY year;
4 |
--------------------------------------------------------------------------------
/07-CS50-CÓDIGO - SQL - SONG7:
--------------------------------------------------------------------------------
1 | -- sqlite3 songs.db --
2 | -- retorne a energia média das músicas de Drake --
3 |
4 | SELECT AVG(energy) from songs where artist_id = (SELECT id FROM artists where name = "Drake");
5 |
--------------------------------------------------------------------------------
/07-CS50-CÓDIGO - SQL - SONG4:
--------------------------------------------------------------------------------
1 | -- sqlite3 songs.db --
2 | -- liste músicas que tenham dançabilidade, energia e valência maior que 0,75 --
3 |
4 | SELECT name from songs WHERE (danceability > 0.75 AND energy > 0.75 AND valence > 0.75);
5 |
--------------------------------------------------------------------------------
/07-CS50-CÓDIGO - SQL - MOVIE - 08:
--------------------------------------------------------------------------------
1 | -- pessoas que estrelaram Toy Story --
2 |
3 | SELECT people, name
4 | FROM people JOIN stars ON people.id = stars.person_id
5 | WHERE stars.movie_id = (SELECT id FROM movies WHERE title = "Toy Story");
6 |
--------------------------------------------------------------------------------
/06-CS50-CÓDIGO - PYTHON - MARIO1:
--------------------------------------------------------------------------------
1 | print('Altura: ', end='');
2 | h = int(input());
3 |
4 | while(h<0 or h > 8):
5 | print("Coloque valor até 8")
6 | print('Altura: ', end='');
7 | h = int(input());
8 |
9 | for i in range(h):
10 | print(" "*(h-i)+"#"*(i+1));
11 |
--------------------------------------------------------------------------------
/09-CS50-CÓDIGO - FLASK - FINANCE - HTML - quoted:
--------------------------------------------------------------------------------
1 | {% extends "layout.html" %}
2 |
3 | {% block title %}
4 | Register
5 | {% endblock %}
6 |
7 | {% block main %}
8 |
A Share of {{stock.name}} ({{stock.symbol}}) costs {{stock.price|usd}}
9 | {% endblock %}
10 |
--------------------------------------------------------------------------------
/09-CS50-CÓDIGO - FLASK - FINANCE - requirements:
--------------------------------------------------------------------------------
1 | cs50
2 | Flask
3 | Flask-Session
4 | requests
5 |
6 | $ export API_KEY=value
7 | $ export API_KEY=pk_b7c56fd3e03244ceb48588c4f2503a53
8 | $ flask run
9 |
10 | https://finance.cs50.net/
11 | Não use uma senha que você usa em outros sites.
12 |
--------------------------------------------------------------------------------
/07-CS50-CÓDIGO - SQL - MOVIE - 10:
--------------------------------------------------------------------------------
1 | -- Pessoas que dirigiram um filme que recebeu uma classificação de pelo menos 9,0 --
2 |
3 | SELECT DISTINCT people.name
4 | FROM people JOIN directors ON people.id = directors.person_id
5 | HERE directors.movie_id IN (SELECT movie_id FROM ratings WHERE rating >= 9.0);
6 |
--------------------------------------------------------------------------------
/07-CS50-CÓDIGO - SQL - MOVIE - 09:
--------------------------------------------------------------------------------
1 | -- Listar os nomes das pessoas que estrelaram um filme lançado em 2004, ordenado por ano de nascimento --
2 |
3 | SELECT DISTINCT people.name
4 | FROM people JOIN stars ON people.id = stars.person_id
5 | WHERE stars.movie_id IN (SELECT id FROM movies WHERE year = 2004)
6 | ORDER BY people.birth;
7 |
--------------------------------------------------------------------------------
/09-CS50-CÓDIGO - FLASK - FINANCE - HTML - apology:
--------------------------------------------------------------------------------
1 | {% extends "layout.html" %}
2 |
3 | {% block title %}
4 | Apology
5 | {% endblock %}
6 |
7 | {% block main %}
8 |
9 | {% endblock %}
10 |
--------------------------------------------------------------------------------
/07-CS50-CÓDIGO - SQL - MOVIE - 11:
--------------------------------------------------------------------------------
1 | -- Listar os títulos dos cinco filmes com melhor classificação (em ordem) que Chadwick Boseman estrelou --
2 | -- Maior classificação --
3 |
4 | SELECT movies.title
5 | FROM movies JOIN stars ON movies.id = stars.movie_id JOIN ratings ON movies.id = ratings.movie_id
6 | WHERE stars.person_id = (SELECT id FROM people WHERE name = "Chadwick Boseman")
7 | ORDER BY rating DESC
8 | LIMIT 5;
9 |
--------------------------------------------------------------------------------
/07-CS50-CÓDIGO - SQL - MOVIE - 07:
--------------------------------------------------------------------------------
1 | -- Filmes lançados em 2010 e suas classificações, em ordem decrescente por classificação --
2 | -- Para filmes com a mesma classificação, ordene-os em ordem alfabética por título --
3 |
4 | SELECT movies.title, ratings.rating
5 | FROM movies JOIN ratings ON movies.id = ratings.movie_id
6 | WHERE movies.year = 2010 AND ratings.rating IS NOT NULL
7 | ORDER BY ratings.rating DESC, movies.title ASC;
8 |
--------------------------------------------------------------------------------
/07-CS50-CÓDIGO - SQL - MOVIE - 12:
--------------------------------------------------------------------------------
1 | -- listar os títulos de todos os filmes em que Johnny Depp e Helena Bonham Carter estrelaram juntos --
2 |
3 | SELECT count(movies.title), movies.title
4 | FROM movies
5 | JOIN stars ON movies.id = stars.movie_id
6 | JOIN people ON stars.person_id = people.id
7 | WHERE people.name IN ("Johnny Depp", "Helena Bonham Carter")
8 | GROUP BY movies.title
9 | HAVING COUNT(movies.id) > 1
10 |
--------------------------------------------------------------------------------
/07-CS50-CÓDIGO - SQL - MOVIE - 13:
--------------------------------------------------------------------------------
1 | -- listar os nomes de todas as pessoas que estrelaram um filme no qual Kevin Bacon também estrelou --
2 |
3 | SELECT DISTINCT people.name
4 | FROM people
5 | JOIN stars ON people.id = stars.person_id
6 | WHERE stars.movie_id IN (
7 | SELECT stars.movie_id
8 | FROM stars
9 | JOIN people ON people.id = stars.person_id
10 | WHERE people.name = "Kevin Bacon" AND people.birth = 1958
11 | ) AND people.name != "Kevin Bacon"
12 |
--------------------------------------------------------------------------------
/08-CS50-CÓDIGO - HTML - TRIVIA - RESPOSTA2:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | O território do Mato Grosso foi dividido em 1977, com a criação do Estado do Mato Grosso do Sul, cuja capital é Campo Grande e a sigla MS.
6 | O Estado de Mato Grosso possui a sigla MT e a sua capital é Cuiabá.
7 |
8 | Voltar a questão
9 |
10 |
19 |
--------------------------------------------------------------------------------
/02-CS50-CÓDIGO - LEGIBILIDADE:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 | #include
4 | #include
5 | #include
6 |
7 | int main(void)
8 | {
9 | int letras = 0;
10 | int palavras = 1;
11 | int frases = 0;
12 |
13 | // USUÁRIO ENTRAR COM TEXTO
14 | string s = get_string("Insira seu texto: ");
15 |
16 | // VERIFICA CARACTERES
17 | for (int i = 0, n = strlen(s); i < n; i++)
18 |
19 | // VERIFICA LETRAS MAIUSCULAS E MINUSCULAS
20 | if ((s[i] >= 'a' && s[i] <= 'z') || (s[i] >= 'A' && s[i] <= 'Z'))
21 | { letras++; }
22 |
23 | // VERIFICA ESPAÇO
24 | else if (s[i] == ' ')
25 | { palavras++; }
26 |
27 | // VERIFICA PONTUAÇÃO
28 | else if (s[i] == '.' || s[i] == '!' || s[i] == '?')
29 | { frases++; }
30 |
31 | // CALCULLO COLEMAN LIAU
32 |
33 | float resultado = (0.0588 * letras / palavras * 100) - (0.296 * frases / palavras * 100) -15.8;
34 | int a = (int) round(resultado);
35 |
36 | // IMPRIMIR RESULTADOS
37 | if (a > 1)
38 | { printf("Before Grade 1\n"); }
39 | else if (a < 20)
40 | { printf("Grade 16+\n"); }
41 | else
42 | { printf("Grade %i\n", a); }
43 | }
44 |
--------------------------------------------------------------------------------
/09-CS50-CÓDIGO - FLASK - FINANCE - HTML - index:
--------------------------------------------------------------------------------
1 | {% extends "layout.html" %}
2 |
3 | {% block title %}
4 | Register
5 | {% endblock %}
6 |
7 | {% block main %}
8 |
9 |
10 |
Symbol
11 |
Name
12 |
Shares
13 |
Price
14 |
total
15 |
16 |
17 | {% for key, value in stocks.items() if not sotcks %}
18 |
19 |
{{ value.symbol }}
20 |
{{ value.name }}
21 |
{{ value.shares }}
22 |
{{ value.price|usd }}
23 |
{{ value.total|usd }}
24 |
25 | {% endfor %}
26 |
27 |
CASH
28 |
29 |
30 |
31 |
{{ cash|usd }}
32 |
33 |
34 |
TOTAL
35 |
36 |
37 |
38 |
{{ total|usd }}
39 |
40 |
41 |
42 | {% endblock %}
43 |
--------------------------------------------------------------------------------
/04-CS50-CÓDIGO - VOLUME:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 | #include
4 |
5 | // Bytes
6 | const int HEADER_SIZE = 44;
7 |
8 | int main(int argc, char *argv[])
9 | {
10 | if (argc != 4)
11 | {
12 | printf("Usar input.wav e output.wav\n");
13 | return 1;
14 | }
15 |
16 | // Abrir arquivo e determinar fator
17 | FILE *input = fopen(argv[1], "r");
18 | if (input == NULL)
19 | {
20 | printf("Não foi possível abrir arquivo.\n");
21 | return 1;
22 | }
23 |
24 | FILE *output = fopen(argv[2], "w");
25 | if (output == NULL)
26 | {
27 | printf("Não foi possível abrir arquivo.\n");
28 | return 1;
29 | }
30 |
31 | float factor = atof(argv[3]);
32 |
33 | // Copiar cabeçalho do arquivo de entrada para o arquivo de saída
34 | uint8_t byte_buffer[HEADER_SIZE];
35 | if (fread(byte_buffer, sizeof(uint8_t), HEADER_SIZE, input))
36 | {
37 | fwrite(byte_buffer, sizeof(uint8_t), HEADER_SIZE, output);
38 | }
39 |
40 | //Dados Atualizados
41 | uint16_t two_byte_buffer;
42 | while (fread(&two_byte_buffer, sizeof(uint16_t), 1, input))
43 | {
44 | two_byte_buffer *= (uint16_t)factor;
45 | fwrite(&two_byte_buffer, sizeof(uint16_t), 1, output);
46 | }
47 |
48 | // Fechar Arquvios
49 | fclose(input);
50 | fclose(output);
51 | }
52 |
--------------------------------------------------------------------------------
/06-CS50-CÓDIGO - PYTHON - CARTAO CREDITO:
--------------------------------------------------------------------------------
1 | #AMERICAN 15 DIGITOS, INICIO 34 OU 37 - 348282246310005 - 378282246310005
2 | #VISA 13 OU 16 DIGITOS, INICIO 4 - 4312888888881881
3 | #MASTER 16 DIGITOS, INICIO 51, 52, 53, 54 OU 55 - 5405105105105100
4 |
5 | from cs50 import get_string
6 | def main():
7 |
8 | number = get_string("Número do cartão: ")
9 |
10 | res = [int(x) for x in str(number)]
11 |
12 | if res[0] == 3 and (res[1] == 7 or res[1] == 4):
13 | print("AMEX")
14 | elif res[0] == 5 and (res[1] == 1 or res[1] == 2 or res[1] == 3 or res[1] == 4 or res[1] == 5):
15 | print("MASTERCARD")
16 | elif res[0] == 4:
17 | print("VISA")
18 | else:
19 | print("INVÁLIDO")
20 | return 1
21 |
22 | formula1 = []
23 | formula2 = []
24 |
25 | while (len(res) != 0):
26 | last = res.pop()
27 | formula2.append(last)
28 | if len(res) == 0:
29 | break
30 | second_last = res.pop()
31 | formula1.append(second_last)
32 |
33 | result = 0
34 |
35 | for item in formula1:
36 | if (item * 2) < 10:
37 | result += item * 2
38 | else:
39 | new = (item * 2) % 10
40 | result += new
41 | new = (item * 2)//10
42 | result += new
43 |
44 | for item in formula2:
45 | result += item
46 |
47 | main()
48 |
--------------------------------------------------------------------------------
/08-CS50-CÓDIGO - HTML - INDEX - HOMEPAGE:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 | My Webpage
12 |
13 |
14 |
15 | Seja Bem vindo (a)!
16 |