This file contains hidden or 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
j = [] | |
for i in range (2000,3201): | |
if (i % 7 == 0) and (i % 5 != 0): | |
j.append(str(i)) | |
print(",".join(j)) |
This file contains hidden or 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
#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') |
This file contains hidden or 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 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: |
This file contains hidden or 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 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") |
This file contains hidden or 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
#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 |
This file contains hidden or 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
#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 |
This file contains hidden or 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
numbers = ["5", "4", "8"] | |
numbers.map!(&:to_s) |
This file contains hidden or 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
numbers = ["5", "4", "8"] | |
numbers.collect { |num| num.to_i} |
This file contains hidden or 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
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:" |
This file contains hidden or 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
puts "nhập chữ vào đây" | |
text = gets.chomp | |
puts text.length < 10 ? "Đ" : "M" |