03 Dec PMCA Sunday 14:00 Python Homework 20.11.29.
Question 1:
Write code in a new file. Create a list of numbers as below:
[-1,2,-10,4,100,-3,10,12]
Find the sum of all the negative numbers and the sum of all the positive numbers separately using the for loop.
Sample Output Positive number Sum: 128 Negative number Sum : -14 Explanation: The positive numbers in the list are 2, 4, 100, 10, 12 and the sum of the positive numbers is 128 and the negative numbers in the list are -1, -10, -3 and the sum of these negative number is -14
Question 2:
Ask the user to input a date in the format “DD/MM/YYYY” and then print the year, month and date from the inputted date.
Sample Input 11/3/2013 Sample Output Day : 11 Month : 3 Year : 2013
Sorry, the comment form is closed at this time.