Write code solutions to the 2 problems below. You can submit (2) py program file
ID: 3743225 • Letter: W
Question
Write code solutions to the 2 problems below. You can submit (2) py program files or submit your code in the online text box. Note: Be sure what you submit in the online text box works. I will not allow resubmits for code that does not run. There is a bonus question at the end, should you decide to complete it, you can submit an additional py program file for grading for a total of 3 program file submissions. One way to do multiplication is by repeated addition. For example, 47 X25 can be evaluated as 47+47+47+...+47 (25 times). Write the code for multiplying two positive numbers a and b using this technique 2. Write the code that will accept a person's name and print it out with a hello message in a box as follows "Hello AndreaExplanation / Answer
1. Program for multiplication by repeated addition
def MulwithAdd(a, b):
Result =0
a=input('Enter value of a')
b=input('Enter value of b')
a=int(a)
b=int(b)
for i in range(0,b) :
Result = Result + a // Repeated addition logic
return Result
print(MulwithAdd(47, 25));
2. Program to take Name as input and print as given
person = input('Enter your name:')
print('*******************')
print('***Hello', person,'***')
print('*******************')
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.