# 2023 Question 1 The following code is meant to find the largest item of a list but the lines are | Assignment Collections

Computer Science 2023 A+ Work

2023 Question 1 The following code is meant to find the largest item of a list but the lines are | Assignment Collections

Question 1: The following code is meant to find the largest item of a list, but the lines are out of order. The following code is meant to define such a function, but the lines are out of order. In your answer put the line numbers in the correct order and introduce appropriate indentation (indent the line numbers to show how the corresponding lines would be indented in your code). Do not write the entire corrected program in your answer.
1 if number > largest:
2 numbers = [3, 5, 2, 1, 4]
3 print largest
4 largest = number
5 for number in numbers:
6 largest = 0

Question 2 : Describe two different ways to represent a birthday register, i.e. the names of your friends and their birth dates. Assume that none of your friends have the same name, but that it is possible for two or more of them to share the same birthday. Do not represent the date as a string. Show how the following data would be represented in both models.
2/Jan Asimov
3/Jan Tolkien
18/July Mandela
18/July Branson

Question 3: Explain the purpose of the following code:
d = {}
if x not in d:
d[x] = 0
d[x] += 1
Question 4: Consider the following code: 1. signFlag = False
2. evenFlag = False
3. inputstr = raw_input(“Enter two numbers: “)
4. num1 = int(inputstr.split(“, “)[0])
5. num2 = int(inputstr.split(“, “)[1])
6. if num1 < 0 and num2 = 0 and num2 >= 0:
10. sign = ‘positive’
11. signFlag = True
12. if num1%2 == 0 and num2%2 == 0:
13. num = ‘even’
14. evenFlag = True
15. if num1%2 != 0 and num2%2 != 0:
16. num = ‘odd’
17. evenFlag = True
18. if signFlag and evenFlag:
19. print num1, ‘and’, num2, ‘are both’, sign, ‘and’, num
20. elif signFlag:
21. print num1, ‘and’, num2, ‘are both’, sign
22. elif evenFlag:
23. print num1, ‘and’, num2, ‘are both’, num
24. else:
25. print num1, ‘and’, num2, ‘have nothing in common’
–Assume that the input is “-12, 14”. Using the given line numbers in this code (at the far left of the listing) list the order (by writing down the line number order) that the code will be executed.
–What is the output for the input “-12, -14”?
–What is the output for the input “-3, 9”?
–Explain in detail what the program does.

Question 5: Write a function file_length(filename) which takes the name of a file as its only parameter, and returns an integer specifying the number of lines in the file.

We give our students 100% satisfaction with their assignments, which is one of the most important reasons students prefer us to other helpers. Our professional group and planners have more than ten years of rich experience. The only reason is that we have successfully helped more than 100000 students with their assignments on our inception days. Our expert group has more than 2200 professionals in different topics, and that is not all; we get more than 300 jobs every day more than 90% of the assignment get the conversion for payment.

## Place Order Now

#write essay #research paper #blog writing #article writing #academic writer #reflective paper #essay pro #types of essays #write my essay #reflective essay #paper writer #essay writing service #essay writer free #essay helper #write my paper #assignment writer #write my essay for me #write an essay for me #uk essay #thesis writer #dissertation writing services #writing a research paper #academic essay #dissertation help #easy essay #do my essay #paper writing service #buy essay #essay writing help #essay service #dissertation writing #online essay writer #write my paper for me #types of essay writing #essay writing website #write my essay for free #reflective report #type my essay #thesis writing services #write paper for me #research paper writing service #essay paper #professional essay writers #write my essay online #essay help online #write my research paper #dissertation writing help #websites that write papers for you for free #write my essay for me cheap #pay someone to write my paper #pay someone to write my research paper #Essaywriting #Academicwriting #Assignmenthelp #Nursingassignment #Nursinghomework #Psychologyassignment #Physicsassignment #Philosophyassignment #Religionassignment #History #Writing #writingtips #Students #universityassignment #onlinewriting #savvyessaywriters #onlineprowriters #assignmentcollection #excelsiorwriters #writinghub #study #exclusivewritings #myassignmentgeek #expertwriters #art #transcription #grammer #college #highschool #StudentsHelpingStudents #studentshirt #StudentShoe #StudentShoes #studentshoponline #studentshopping #studentshouse #StudentShoutout #studentshowcase2017 #StudentsHub #studentsieuczy #StudentsIn #studentsinberlin #studentsinbusiness #StudentsInDubai #studentsininternational