BIC1114编程讲解、辅导program程序语言、讲解Java,Python编程 讲解Python程序|解析R语言编程
- 首页 >> Java编程 BIC1114: Introduction to Programming
April 20, 10am to 1 pm
Name:
Student Id:
Answer ALL Questions
You can use library built in functions in your program
1. Write a program to find the smallest positive number in a list L that has both negative and positive numbers. L=[-2, 15, 6,-4, -23,3,-21,12,]. (20 Marks)
2. Write a program to sort the negative numbers only in an ascending order in the given list A= [-5, 27, -12, 4,19, -8,-13]. The sorted list consists of negative numbers in an ascending order followed by the positive numbers in the List.
Your solution should look like this: A =[-13,-12,-8,-5,27,4,19]
(20 Marks)
3. Write a program to sum all the digits in a String that has digits and characters to a single digit. For example S = ‘&a97Z8;CDE398?’. (20 Marks)
4. Write a program to find the sum of two numbers in a list. The sum includes the largest positive number and the largest negative number for a list that has both positive and negative numbers. For the case, when the list consists of either negative numbers or positive numbers only, then the sum for each case is the sum of the largest and the next largest numbers in that list.
For example, if A=[4,-7,12,-3,2,-6,15,-12]… sum= 15 + (-3)
For example, if A=[4,7,12,3,2,6,15,12]… sum= 15 + 12
For example, if A=[-4,-7,-12,-3,-2,-6,-15,-12]… sum= -2 + (-3).
(40 Marks)
You are required to submit the following:
i) Token and student Id
ii) 4 python files for each question
You need to submit the above to the link provided in the CN. You will be deducted 30% of total score if you submit not using the link provided or fail to follow the submission requirements.
April 20, 10am to 1 pm
Name:
Student Id:
Answer ALL Questions
You can use library built in functions in your program
1. Write a program to find the smallest positive number in a list L that has both negative and positive numbers. L=[-2, 15, 6,-4, -23,3,-21,12,]. (20 Marks)
2. Write a program to sort the negative numbers only in an ascending order in the given list A= [-5, 27, -12, 4,19, -8,-13]. The sorted list consists of negative numbers in an ascending order followed by the positive numbers in the List.
Your solution should look like this: A =[-13,-12,-8,-5,27,4,19]
(20 Marks)
3. Write a program to sum all the digits in a String that has digits and characters to a single digit. For example S = ‘&a97Z8;CDE398?’. (20 Marks)
4. Write a program to find the sum of two numbers in a list. The sum includes the largest positive number and the largest negative number for a list that has both positive and negative numbers. For the case, when the list consists of either negative numbers or positive numbers only, then the sum for each case is the sum of the largest and the next largest numbers in that list.
For example, if A=[4,-7,12,-3,2,-6,15,-12]… sum= 15 + (-3)
For example, if A=[4,7,12,3,2,6,15,12]… sum= 15 + 12
For example, if A=[-4,-7,-12,-3,-2,-6,-15,-12]… sum= -2 + (-3).
(40 Marks)
You are required to submit the following:
i) Token and student Id
ii) 4 python files for each question
You need to submit the above to the link provided in the CN. You will be deducted 30% of total score if you submit not using the link provided or fail to follow the submission requirements.