Skip to content

Instantly share code, notes, and snippets.

View leoodz's full-sized avatar
⌨️
Focusing

Leo Pham leoodz

⌨️
Focusing
View GitHub Profile
@leoodz
leoodz / bt1.py
Created February 27, 2020 16:33
​Viết chương trình tìm tất cả các số chia hết cho 7 nhưng không phải bội số của 5, nằm trong đoạn 2000 và 3200 (tính cả 2000 và 3200). Các số thu được sẽ được in thành chuỗi trên một dòng, cách nhau bằng dấu phẩy.
j = []
for i in range (2000,3201):
if (i % 7 == 0) and (i % 5 != 0):
j.append(str(i))
print(",".join(j))
#Requirement:
#Code Wars Exes and Ohs
# Return boolean True if same amount of "X's" and "O's", if different amount return false
#Else return error string does not have X's and O'x
#if there is no X's or O's return True
def xo(s):
return s.lower().count('x') == s.lower().count('o')
def is_valid_walk(walk):
#determine if walk is valid
if walk == 'n' or walk == 's' or walk == 'w' or walk == 'e' and walk.len() > 0:
print(walk)
return True
walk = ['n','s','n','s','n','s','n','s','n','s']
is_valid_walk(walk)
if is_valid_walk == True:
@leoodz
leoodz / main.py
Created February 26, 2020 13:09
Test pygame
import pygame
#must have
pygame.init()
#create the window gui
screen = pygame.display.set_mode((800,600))
#title and icon
pygame.display.set_caption("Alien invation")
#include <stdio.h>
int main()
{
int n, i;
int giaithua = 1;
printf("nhap 1 so nguyen: ");
scanf("%d",&n);
if (n < 0)
printf("ko co giai thua cua so am.");
else
#include <stdio.h>
#include <stdlib.h>
#define BOOL short int
#define TRUE 1
#define FALSE 0
#define NUMBER_OF_ROWS 3
#define NUMBER_OF_COLUMNS 3
numbers = ["5", "4", "8"]
numbers.map!(&:to_s)
numbers = ["5", "4", "8"]
numbers.collect { |num| num.to_i}
array = [1,2, 6 ,4, 2, "ĐM Mèo", 5599, "chim cu cu"]
print "chọn 1 để in ra số chẵn,2 để in ra strings:"
choice = gets.chomp
case choice
when "1"
puts array.select { |item| item.is_a?(Integer) && item.even? }
when "2"
puts array.select { |item| item.is_a?(String) }
else
puts "Chọn 1 hoặc 2 thôi :mad:"
puts "nhập chữ vào đây"
text = gets.chomp
puts text.length < 10 ? "Đ" : "M"