def mean(*args):
return sum(args, 0.0) / len(args)mean(*[1, 2, 3]) # 2.0
mean(1, 2, 3) # 2.0def mean(*args):
return sum(args, 0.0) / len(args)mean(*[1, 2, 3]) # 2.0
mean(1, 2, 3) # 2.0def all_unique(lst):
return len(lst) == len(set(lst))x = [1, 2, 3, 4, 5, 6]
y = [1, 2, 2, 3, 4, 5]
all_unique(x) # True
all_unique(y) # Falsedef all_equal(lst):
return lst[1:] == lst[:-1]all_equal([1, 2, 3, 4, 5, 6]) # False
all_equal([1, 1, 1, 1]) # True| # Create a list of strings: flash | |
| flash = ['jay garrick', 'barry allen', 'wally west', 'bart allen'] | |
| # Print each list item in flash using a for loop | |
| for item in flash: | |
| print(item) | |
| # Create an iterator for flash: superhero | |
| superhero = iter(flash) | |
| # Print each item from the iterator | |
| print(next(superhero)) | |
| print(next(superhero)) |
| <?php | |
| function store_map_enqueue_scripts(){ | |
| global $cmb_booking, $cmb_review, $cmb_store, $cmb_user, $contentLang; | |
| //load full version or minified version of javascript | |
| //$prefix = WP_DEBUG ? '' : '.min'; | |
| $prefix = NULL; | |
| // Google Fonts | |
| //wp_enqueue_style( 'natosans', '//fonts.googleapis.com/css?family=Noto+Sans:400,700'); |
| /** | |
| * Optimize WooCommerce Scripts | |
| * Remove WooCommerce Generator tag, styles, and scripts from non WooCommerce pages. | |
| */ | |
| add_action( 'wp_enqueue_scripts', 'child_manage_woocommerce_styles', 99 ); | |
| function child_manage_woocommerce_styles() { | |
| //remove generator meta tag | |
| remove_action( 'wp_head', array( $GLOBALS['woocommerce'], 'generator' ) ); |
| <?php | |
| function changeDigitsEtoB( $digits ) { | |
| $bangla = numfmt_format(numfmt_create( 'bn_BD', NumberFormatter::TYPE_DEFAULT ),$digits); | |
| return $bangla; | |
| } |
| @echo off | |
| set /p UserInputPath= Enter directory name : | |
| :: mkdir %UserInputPath% | |
| :: mkvirtualenv biman | |
| :: workon biman | |
| :: pip install django | |
| :: pip install django-admin | |
| django-admin startproject %UserInputPath% |
| admin.site.site_header = 'The Suncoin Admin' | |
| admin.site.index_title = 'Admin Panel' | |
| admin.site.site_title = 'The Suncoin' |