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
def return_percentage(minutes): | |
percentage = (minutes/60)*100 | |
return int(percentage) |
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
def nested_while_loop_box(): | |
row = 0 | |
col = 0 | |
box = '' | |
while row < 4: | |
while col < 4: | |
box = box + '****' | |
row += 1 | |
box = box + '\n' | |
col += 1 |
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
def nested_pyramid(): | |
pyramid = '' | |
for num in range(1): | |
for char in range(1,6): | |
pyramid = pyramid + '*' * char + '\n' | |
return pyramid |
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
def nested_box(): | |
box = '' | |
for col in range(4): | |
if col == 0: | |
box = box | |
else: | |
box = box + '\n' | |
for row in range(4): | |
box = box + '*' | |
box = box + '\n' |
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
noun = input('Please enter a noun') | |
verb = input('Please enter a verb') | |
adjective = input('Please enter an adjective') | |
adverb = input('Please enter an adverb') | |
print ('The ' + adjective + noun + verb + adverb) | |
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
def is_reverse(word1, word2): | |
if len(word1) != len(word2): | |
return False | |
i = 0 | |
j = len(word2)-1 | |
while j > -1: | |
print (i, j) #print here | |
if word1[i] != word2[j]: |
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
def inverted_pyramid(): | |
pyramid = '' | |
pylength = [1,2,3,4,5] | |
for num in range(1): | |
for char in reversed(pylength): | |
pyramid = pyramid + '*' * char + '\n' | |
return pyramid |
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
def highest_number_cubed(limit): | |
answer = 0 | |
for num in range(limit): | |
print (num**3) | |
if num**3 > limit: | |
answer = num - 1 | |
return answer | |
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
#This program says hello and asks for my name | |
print('Hello world') | |
print('What is your name?') # ask for their name | |
myName = input() | |
print('It is good to meet you, ' + myName) | |
print('The length of your name is:') | |
print(len(myName)) |
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
prefixes = 'JKLMNOPQ' | |
suffix = 'ack' | |
for letter in prefixes: | |
if letter == 'O' or letter == 'Q': | |
print (letter + 'u' + suffix) | |
else: | |
print (letter + suffix) |