# Argument function

**URL:** <https://forum.codewithmosh.com/t/argument-function/16280>\
**Category:** Python\
**Created:** [November 4, 2022, 2:38am UTC](https://forum.codewithmosh.com/t/argument-function/16280 "2022-11-04T02:38:54Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Maxwell\_osagie](https://avatars.discourse-cdn.com/v4/letter/m/94ad74/32.png) [@Maxwell\_osagie](https://forum.codewithmosh.com/u/Maxwell_osagie)\
**Post date:** [November 4, 2022, 2:38am UTC](https://forum.codewithmosh.com/t/argument-function/16280/1 "2022-11-04T02:38:55Z")

</div>

Am new to programming. How do I understand the argument function well

---

<div class="post-metadata">

**Author:** ![jmrunkle](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.codewithmosh.com/jmrunkle/32/3765_2.png) [@jmrunkle](https://forum.codewithmosh.com/u/jmrunkle)\
**Post date:** [November 4, 2022, 6:16am UTC](https://forum.codewithmosh.com/t/argument-function/16280/2 "2022-11-04T06:16:07Z")

</div>

Could you clarify what you are having trouble understanding? Maybe show an example of the syntax and ask more specific questions about the example?

---

<div class="post-metadata">

**Author:** ![Maxwell\_osagie](https://avatars.discourse-cdn.com/v4/letter/m/94ad74/32.png) [@Maxwell\_osagie](https://forum.codewithmosh.com/u/Maxwell_osagie)\
**Post date:** [November 4, 2022, 6:52am UTC](https://forum.codewithmosh.com/t/argument-function/16280/3 "2022-11-04T06:52:58Z")

</div>

question  
the exercise will explore the different ways you can specify arguments to a functions  
for the question define the following function and then answer the following questions

def president (d \_ votes, r \_ votes, current = ’ donald trump’, d \_ nominee = ’ joe biden’, r nominee = ’ donald trump’)

print (" the current president of USA "; current, end = ‘’)

if (d \_ votes \> r \_ votes);  
print (" the new president will be ", d \_ nominee)  
else:  
print ('the new president will be ', r \_ nominee)

1. enter the output produced when you type the following:  
president (274, 264)

2. enter the output produced when you type in the following:  
president (332, 206, d \_ nominee = " Elizabeth warren ", r \_ nominee = mike pence

3. enter the cod you would type if the democratic nominee was Hillary Clinton, and the republican nominee was mitt Romney and the number of electoral votes for the democrats was 270 and for the republicans was 268

i do not understand what they are saying. i have done all i seem not to get it. pls explain to me when you do understand . please

---

<div class="post-metadata">

**Author:** ![Maxwell\_osagie](https://avatars.discourse-cdn.com/v4/letter/m/94ad74/32.png) [@Maxwell\_osagie](https://forum.codewithmosh.com/u/Maxwell_osagie)\
**Post date:** [November 4, 2022, 7:00am UTC](https://forum.codewithmosh.com/t/argument-function/16280/4 "2022-11-04T07:00:50Z")

</div>

question  
the exercise will explore the different ways you can specify arguments to a functions  
for the question define the following function and then answer the following questions

def president (d \_ votes, r \_ votes, current = ’ donald trump’, d \_ nominee = ’ joe biden’, r nominee = ’ donald trump’)

print (" the current president of USA "; current, end = ‘’)

if (d \_ votes \> r \_ votes);  
print (" the new president will be ", d \_ nominee)  
else:  
print ('the new president will be ', r \_ nominee)

1. enter the output produced when you type the following:  
president (274, 264)

2. enter the output produced when you type in the following:  
president (332, 206, d \_ nominee = " Elizabeth warren ", r \_ nominee = mike pence

3. enter the cod you would type if the democratic nominee was Hillary Clinton, and the republican nominee was mitt Romney and the number of electoral votes for the democrats was 270 and for the republicans was 268

i do not understand what they are saying. i have done all i seem not to get it. pls explain to me when you do understand . please

(Attachment Lab02 programming.pdf is missing)

---

<div class="post-metadata">

**Author:** ![Maxwell\_osagie](https://avatars.discourse-cdn.com/v4/letter/m/94ad74/32.png) [@Maxwell\_osagie](https://forum.codewithmosh.com/u/Maxwell_osagie)\
**Post date:** [November 4, 2022, 8:53pm UTC](https://forum.codewithmosh.com/t/argument-function/16280/5 "2022-11-04T20:53:07Z")

</div>

it about explaining argument function knowing the keyword and how to answer the question

n this exercise, you will modify the above function code to return the product of the items on the list rather than the sum. There are three lines of code in the above program  
:\>\>\>from func tools import  
reduce Line 1:

> > > def sum(seq):  
> > > Line 2: … def add(x,y):  
> > > return x+y  
> > > Line 3: … return reduce(add, seq)  
> > > For your modified function, you will need to use the exact same number of lines of code.[Note: In the answers you submit below, do not include any indentation in your code. Use appropriate function names and similar spacing as above.  
> > > ]Q9 Enter the code in your new program for Line 1.  
> > > ]Q10 Enter the code in your new program for Line 2.  
> > > Q11 Enter the code in your new program for Line 3  
> > > Q12 Enter the code you would type to run your new function to return the product of the numbers 10, 11, 12, … up to and including 20  
> > > Q13 Enter the output produced when you run the code you devised for Q2

pls i need thorough explanation to answer the rest
