| University | Singapore University of Social Science (SUSS) |
| Subject | FIN551: Python Programming |
(a) Write statements for the following tasks:
(i) Given a 2-digit whole number, n, display the message Valid if n contains the digit 1. For example, 10, 11 and 31 are valid but 33, 34 and 35 are not. Do not convert n into a string.
(ii) Given that string s has exactly 3 characters. Display the message Group A if characters in the first, middle and last positions are the same. For example, if s is ‘222’, display Group A. Display message Group B if the first and last characters are the same but the middle character is different. For example, if s is ‘232’, display Group B. Display message Group C if the first and last characters are not the same. For example, if s is ‘223’ or ‘213’, display Group C.
(iii) Given a list of numbers, nList such as [1, 3, 2]. If the sum of digits in the even position is even, display the message Sum of digits in even positions is even. Otherwise, display the message Sum of digits in even positions is odd. Do not use loop/repetition structure. Instead, use the slice operator and the built-in function sum.
(b) Given a string, s that contains a sequence of digits.
(i) Write a code segment that picks each digit in the string in reverse order, reduces each digit by 1 and displays the resulting number on separate lines. The code segment should produce the output for a given string ‘1204’: 3
-1
1
0
(ii) Write a code segment that prints the message True if the sum of each pair of adjacent digits does not exceed 12. Print the message False otherwise. For illustration, suppose the string s has 5 digits: d0d1d2d3d4. If d0 + d1, d1 + d2, d2 + d3, d3 + d4 do not exceed 12, the code segment prints True. Thus, for the string ‘48531’, the code segment prints the message False because the sum of pair of adjacent digits 85, or 8+5 exceeds 12.
Buy Custom Answer of This Assessment & Raise Your Grades
Are you searching for someone to do my assignment? then don't stress at Singapore Assignment Help we have proficient suss assignment experts who have an amazing capability to design outstanding solutions on FIN551: Python Programming Assignment. Our experts work 24*7 hours to provide all assignment answers before the deadline.
Looking for Plagiarism free Answers for your college/ university Assignments.
- Research Proposal Assignment 3: Health Services Research Study Proposal
- CS5224 Cloud Computing Assignment Lab 2: Cloud Services
- SOC319 Sociology of Health and Healthcare End-of-Course Assessment – July Semester 2025
- BME356 Functional Genomics End-of-Course Assessment – July Semester 2025
- SBP310 Fundamentals of Sustainable Business Practices End-of-Course Assessment – July Semester 2025
- Elements of Economics Continuous Assessment 01 – Univarsity of Embu (UoEm)
- MECO6936 Social Media Communication Campaign Plan Essay Semester 2, 2025
- S2450C Health Promotion Coursework Assessment AY2025 – Republic Polytechnic
- PSB7010CL Strategic Project Management Individual Assignment Written Report
- SOC371 Science Technology and Society End-of-Course Assessment – July Semester 2025
