Skip to content
Snippets Groups Projects
Commit 4eae5b6b authored by Daniel Moix's avatar Daniel Moix
Browse files

Week 5 lecture

parent fed6e946
No related branches found
No related tags found
No related merge requests found
# Given a list of integer values, write Python code
# using a for loop and range to sum the values in the list.
#
# Then, confirm that your code results in the same answer
# as sum()
nums = [8, 6, 7, 5, 3, 0, 9]
myAnswer = nums[0]
for index in range(0, len(nums)):
value = nums[index]
if value < myAnswer:
myAnswer = value
print(myAnswer == min(nums)) #??
\ No newline at end of file
for i in range(1, 5):
for j in range(1, 3):
print(i,j)
\ No newline at end of file
# for letter in "Hello":
# print(letter)
for i in range(1, 10):
print(i)
text = "127.0.0.1"
parts = text.split(".")
together = "[DOT]".join(parts)
print(together)
# vals = [10, 20, [30, 40], [50, 60, 70]]
#
# print(len(vals))
# for val in vals:
# print(val)
\ No newline at end of file
value = 17
values = [3, 1, 4, 1, 5, 9]
word = "Dragon"
letters = list(word) #str(), int(), float(), list()
myDigits = [0, 0, 1, 1, 0, 0]
yourDigits = list(myDigits)
yourDigits[0] = 99
print(word)
print(letters)
print(yourDigits)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment