Posted: February 12th, 2023
lowing.
· Everything is case sensitive, so BE CAREFUL
· After you create the object (e.g., Q1), DO NOT PRINT! Your file should something look like this:
Q1 = [‘Hello’]
Q2 = x[3:]
Before attempting these make sure to watch ‘CodeGrade Walkthrough’ in module 1 – if you do not you will not understand how assignments work!
For reference:
CodeGrade – What to do if my code doesn’t work?
Note: Be sure to define your functions in reference to previously created strings/lists as opposed to passing a string/list as an argument to the function.
· Create a string called Q1 with the characters “Data Science for all!”
· Create a function called Q2 that loops through and prints each character in Q1.
For example: The string “Data” would print:
D
a
t
a
· Create a function called Q3 that loops through each character in Q1 and prints “A” for each character.
For example: The string “Data” would print:
A
A
A
A
· Create a list called Q4 with the following five items: DTSC 520, DTSC 550, DTSC 575, DTSC 600, DTSC 650
· Create a function called Q5 that loops through and prints each item in Q4.
For example:
DTSC 520
DTSC 550
DTSC 575
DTSC 600
DTSC 650
· Create a function called Q6 that loops through and prints all values less than 50, starting with 2, such that the value is doubled each iteration.
For example:
2
4
8
16
32
· Create a list containing the following numbers: 2, 3, 5, 7, 11, 13, 17, 19, 23, 29. Assign it to Q7.
· Create a function called Q8 that loops through Q7, adding all the numbers together and returning the sum.
For example: When you invoke Q8, it should return 129 since 2 + 3 + 5 + 7 + 11 + 13 + 17 + 19 + 23 + 29 = 129.
· Create a function called Q9 that uses a loop to determine how many times, starting with the number 3, a number can be squared until it reaches at least a twenty digit number
For example: It takes three times, starting with the number 3, that a number can be squared until it reaches a four digit number: 3^2 = 9, 9^2 = 81, 81^2=6561).
· Create a .ipynb file called IntroPythonA3credit.ipynb and complete the following.
· Everything is case sensitive, so BE CAREFUL
· After you create the object (e.g., Q1), DO NOT PRINT! Your file should something look like this:
Q1 = [‘Hello’]
Q2 = x[3:]
Before attempting these make sure to watch ‘CodeGrade Walkthrough’ in module 1 – if you do not you will not understand how assignments work!
For reference:
CodeGrade – What to do if my code doesn’t work?
Note: Only the words should be strings in these lists.
· Create a list called Q1 containing the following three items in the given order: one , 1 , and 1.0 .
· Create a list called q2 containing the following three items in the given order: two , 2 , and 2.0 . Without redefining (or recreating) the list, alter the list such that the second item in the list becomes dos . Assign it to Q2.
· Create a list called q3 containing the following three items in the given order: three , 3 , and 3.0 . Without redefining (or recreating) the list, attach tres to the end of q3’s list. Assign it to Q3.
· Create a list called q4a containing the following three items in the given order: four , 4 , and 4.0 . Create another list called q4b containing the following four items in the given order: eight , 8 , 8.0 , and ocho . Attach q4b’s list to the end of q4a’s list, creating a list of length 7. Assign it to Q4.
· Create a list called q5a containing the following two items in the given order: five and 5 . Create another list called q5b containing the following four items in the given order: nine , 9 , 9.0 , and nueve . Attach the entire q5b to the end of q5a’s list, creating a list of length 3 (tip: think of a list inside a list). Assign it to Q5.
· Find the length of q5b and assign it to Q6.
· Multiply q5b by 3 and assign it to Q7.
· Assign to Q8 the last item in Q5 by indexing the Q5 list.
IntroPythonA1 ● Create a .ipynb file called IntroPythonA1.ipynb and complete the following. ● For this assignment you can not load any libraries. Subsequent assignments might
require libraries, so please read instructions carefully. ● After you create the object (e.g., Q1), DO NOT PRINT! Your file should something look
like this:
Q1 = [‘Hello’] Q2 = x[3:]
Before attempting these make sure to watch ‘CodeGrade Walkthrough’ in module 1 – if you do not you will not
understand how assignments work!
For reference: CodeGrade tips and FAQ CodeGrade – What to do if my code doesn’t work?
● Create a string called Q1 with the characters “Welcome to EU!”
● Slice Q1 to obtain only EU! and assign it to Q2
● Slice Q1 to obtain only me to and assign it to Q3 (note the space after ‘to’)
● Create a list called Q4 that includes: ○ Eric Camacho ○ Elmer Felicitas ○ Shankar Lucrece ○ Gitta Nevena ○ Rasmus Tarquinius
● Create a list called Q5 that includes: ○ 7 ○ ‘7’ ○ ‘Seven’ ○ 7.0
● Slice Q4 and obtain only [‘Gitta Nevena’, ‘Rasmus Tarquinius’]. Assign it to Q6
● Slice Q5 to obtain only [‘7’, ‘Seven’] Assign it to Q7.
● Create a list called mylist that contains [4, 8, 11, 3, 19, 2, 5, 8, 12, 9]. Slice that list to obtain the corresponding:
Q8: [4, 8, 11]
Q9: [8, 12, 9]
Q10: [11, 3, 19, 2]
Q11: [2, 5]
SOLUTION
A code walk-through, also known as code review, is a process of thoroughly examining the source code of a software program in order to find and fix bugs, improve code quality, and share knowledge among team members. During a code walk-through, a team of developers and stakeholders review the code line by line, discussing its design, implementation, and compliance with coding standards and best practices. The goal of a code walk-through is to identify and address any issues or improvements before the code is released to production.
Here is a typical process for conducting a code walk-through:
Code walk-throughs can be a valuable tool for improving code quality and ensuring that software is free of bugs and vulnerabilities. By engaging in regular code walk-throughs, teams can foster a culture of collaboration, knowledge sharing, and continuous improvement.
Place an order in 3 easy steps. Takes less than 5 mins.