联系方式

  • QQ:99515681
  • 邮箱:99515681@qq.com
  • 工作时间:8:00-23:00
  • 微信:codinghelp

您当前位置:首页 >> Python编程Python编程

日期:2021-04-25 05:22

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.  


版权所有:留学生编程辅导网 2020 All Rights Reserved 联系方式:QQ:99515681 微信:codinghelp 电子信箱:99515681@qq.com
免责声明:本站部分内容从网络整理而来,只供参考!如有版权问题可联系本站删除。 站长地图

python代写
微信客服:codinghelp