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
name = input("Your name please?") | |
age = int(input("Please enter your age?")) + 100 | |
print("Your name is "+name+ " and in 100 years you will be "+str(age)) |
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
num = int(input("Please enter first number")) | |
check = int(input("Please enter second number")) | |
result = check/num | |
if(result % 4 == 0): | |
print ( str(result)+ "\nYour number is a number multiple of 4") | |
elif(result % 2 == 1): | |
print ( str(result)+ "\nYour result is an odd number") | |
else: | |
print ( str(result)+ "\nYour result is an even number") |
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
a = [1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89] | |
num = int(input("Please enter number")) | |
x = [] | |
for element in a: | |
if element < num : | |
x.append(element) | |
print (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
num = int(input("Please put a number to divide")) | |
divisorList = [] | |
listRange = list(range(1,num+1)) | |
for number in listRange: | |
if num % number == 0: | |
divisorList.append(number) | |
print (divisorList) |
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 | |
a = random.sample(range(50),20) #Sample won't have any duplicate value | |
b = random.sample(range(50),20) | |
#See number that are generated by a | |
print (a) | |
#See number that are generated by b | |
print (b) | |
c = [] |
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
# Strings are list | |
words = str(input("Type in words that you think is palindrome : ")) | |
palindrome = words[::-1] | |
print (words+" "+palindrome) | |
if words == palindrome: | |
print("Your words is palindrome") | |
else : | |
print("Unfortunately this is not palindrome") |
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 | |
number = random.sample(range(50),20) | |
evenNumber = [] | |
print (number | |
) | |
for even in number: | |
if even % 2 == 0: | |
evenNumber.append(even) |
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
<?php | |
require dirname(__FILE__).'/wp-blog-header.php'; | |
$wpdb->query("DELETE FROM wp_terms WHERE term_id IN (SELECT term_id FROM wp_term_taxonomy WHERE taxonomy LIKE 'pa_%')"); | |
$wpdb->query("DELETE FROM wp_term_taxonomy WHERE taxonomy LIKE 'pa_%'"); | |
$wpdb->query("DELETE FROM wp_term_relationships WHERE term_taxonomy_id not IN (SELECT term_taxonomy_id FROM wp_term_taxonomy)"); | |
$wpdb->query("DELETE FROM wp_term_relationships WHERE object_id IN (SELECT ID FROM wp_posts WHERE post_type IN ('product','product_variation'))"); | |
$wpdb->query("DELETE FROM wp_postmeta WHERE post_id IN (SELECT ID FROM wp_posts WHERE post_type IN ('product','product_variation'))"); | |
$wpdb->query("DELETE FROM wp_posts WHERE post_type IN ('product','product_variation')"); |
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
<?php | |
/* | |
Plugin Name: bacs-to-pending-payment | |
Description: Change bank transfer default order status from on Hold to pending payment | |
Version: 1.0.0 | |
Contributors: Suherman Ng | |
Author: Suherman NG | |
Author URI: | |
License: GPLv2 or later | |
Text Domain: CAF website |
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
<?php | |
if ( is_singular('product') ) { | |
global $post; | |
// get categories | |
$terms = wp_get_post_terms( $post->ID, 'product_cat' ); | |
foreach ( $terms as $term ) $cats_array[] = $term->term_id; | |
$query_args = array( 'post__not_in' => array( $post->ID ), 'posts_per_page' => 5, 'no_found_rows' => 1, 'post_status' => 'publish', 'post_type' => 'product', 'tax_query' => array( | |
array( | |
'taxonomy' => 'product_cat', | |
'field' => 'id', |
OlderNewer