Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 15 additions & 6 deletions Python_Exercises.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@
def power(a,b):

# ** What is 7 to the power of 4?**

return None

return a**b
out= power(7,4)
print(out)



Expand All @@ -20,7 +22,9 @@ def split_str(s):
#
# **into a list. **

return None
return s.split()
output= split_str("Hi there Sam!")
print(output)


def format(planet,diameter):
Expand All @@ -35,16 +39,19 @@ def format(planet,diameter):
# The diameter of Earth is 12742 kilometers.

return None

print("The diameter of {planet} is {diameter} kilometers." .format(planet='Earth', diameter='12742'))


def indexing(lst):

# ** Given this nested list, use indexing to grab the word "hello" **

#lst = [1,2,[3,4],[5,[100,200,['hello']],23,11],1,7]
return None
lst = [1,2,[3,4],[5,[100,200,['hello']],23,11],1,7]
lst[3][1][2]

return None



def dictionary(d):
Expand All @@ -55,6 +62,8 @@ def dictionary(d):


return None
d = {'k1':[1,2,3,{'tricky':['oh','man','inception',{'target':[1,2,3,'hello']}]}]}
d['k1'][3]['tricky'][3]['target'][3]


def subjective():
Expand All @@ -63,7 +72,7 @@ def subjective():
# Tuple is _______

return None

immutable



Expand Down