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
| # practicepython.org Ex 06 | |
| word_og = raw_input("Palindrome checker. Enter your palindrome: ") | |
| word = word_og.replace(" ", "") | |
| start = 0 | |
| while (len(word) / 2) > start: | |
| end = -(start + 1) | |
| if word[start] == word[end]: |
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
| # practicepython.org Ex 05 | |
| import random as ra | |
| def randrng(): | |
| numlist = [] | |
| rnglen = ra.randrange(10, 20) | |
| while rnglen > 0: | |
| numlist.append(ra.randrange(1, 100)) | |
| rnglen -= 1 |
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
| # practicepython.org Ex 03 | |
| a = [1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89] | |
| z = [] | |
| for integer in a: | |
| if (integer < 5): | |
| z.append(integer) | |
| print (z) |
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
| # practicepython.org Ex 02 | |
| num = int(raw_input ( "Enter a number you would like divided: " )) | |
| check = int(raw_input ( "Enter a number you want to divide by: ")) | |
| rem = str( num % check ) | |
| divby2 = num % 2 | |
| if divby2 == 0: | |
| print ( str(num) + " is EVEN." ) | |
| else: | |
| print ( str(num) + " is ODD." ) |
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
| # practicepython.org Ex 01 | |
| name = raw_input( "Please enter your name: " ) | |
| age = int(raw_input ( "Please enter your age: " )) | |
| age = str( 100 - age ) | |
| print ( "Hi, " + name + "! You will turn 100 years old in " + age + " years!" ) |
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 os | |
| import shutil | |
| import hashlib | |
| # Define variables | |
| directory = raw_input( "Drag and drop the file or folder you want to back up." ) # Accepts input from user for source file path. | |
| directory = directory.rstrip(" ") + "/" # Formats variable. | |
| backup_path = raw_input( "Drag and drop the location to which you want to back up." ) # Accepts input from user for destination file path. | |
| backup_path = backup_path.rstrip(" ") + "/" # Formats variable. | |
| errnum = 0 |
NewerOlder