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
| //add image to the storage disk. | |
| public function uploadImageViaAjax(Request $request) | |
| { | |
| $name = []; | |
| $original_name = []; | |
| foreach ($request->file('file') as $key => $value) { | |
| $image = uniqid() . time() . '.' . $value->getClientOriginalExtension(); | |
| $destinationPath = public_path().'/images/'; | |
| $value->move($destinationPath, $image); | |
| $name[] = $image; |
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
| a = [1,10,5,6,7,3,2,8,88,20] | |
| b=[] | |
| user = int(raw_input("enter a number to compare: ")) | |
| for num in a: | |
| if num >= user: | |
| b.append(num) | |
| print b |
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
| number = int(raw_input("enter a number: ")) | |
| if number % 2 == 0: | |
| if number % 4 ==0: | |
| print "%s is an even number and multiple of 4" %number | |
| else: | |
| print "%s is an even number" %number | |
| else: | |
| print "%s is an odd number" %number |
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
| from datetime import datetime | |
| now = datetime.now() | |
| name = raw_input("enter your name: ") | |
| age = raw_input("enter your age: ") | |
| nprint = int(raw_input("enter the number of times to print the message: ")) | |
| year = now.year | |
| century = ((100-int(age))+ year) | |
| message = "%s you are now %s and you will be hundread years old in %s "\ | |
| %(name,age,century) | |
| print nprint*message |