#TC1014 #WSQ08 On to functions

For this WSQ i had to read chapter 3 of the book ”  “Think Python, How to Think Like a Computer Scientist” which explained how to make functions.

Here’s my code:

ROGEL GARCÍA A01630171

def osuma (num1,num2):

suma=num1+num2 line must be idented in order for the function to work properly.

return suma  #this line must be idented in order for the function to work properly.

 

def oresta (num1,num2):

resta=num1-num2 #this line must be idented in order for the function to work properly.

return resta  #this line must be idented in order for the function to work properly.

 

def omulti (num1,num2):

multi=num1*num2  #this line must be idented in order for the function to work properly.

return multi  #this line must be idented in order for the function to work properly.

 

def odiv (num1,num2):

div=num1/num2

return div

 

def orem(num1,num2):

rem= num1%num2  #this line must be idented in order for the function to work properly.

return rem  #this line must be idented in order for the function to work properly.

 

 

num1 = int(input(“Give me a number: “)) 

num2 = int(input (“Give me another number: “))

 

su=osuma(num1,num2)

res=oresta(num1,num2)

mult=omulti(num1,num2)

di=odiv(num1,num2)

re=orem(num1,num2)

 

print (“The sum of your numbers is”, su) 

print (“The difference of your numbers is”, res) 

print (“The product of your numbers is”, mult) 

print (“The division of your numbers is”, int(di)) 

print(“The remainder of the division of your numbers is”, int(re)) 

CC BY 4.0 #TC1014 #WSQ08 On to functions by Gilberto Rogel García is licensed under a Creative Commons Attribution 4.0 International License.

Comments are closed.

#TC1014 #WSQ08 On to functions

For this WSQ i had to read chapter 3 of the book ”  “Think Python, How to Think Like a Computer Scientist” which explained how to make functions.

Here’s my code:

ROGEL GARCÍA A01630171

def osuma (num1,num2):

suma=num1+num2 line must be idented in order for the function to work properly.

return suma  #this line must be idented in order for the function to work properly.

 

def oresta (num1,num2):

resta=num1-num2 #this line must be idented in order for the function to work properly.

return resta  #this line must be idented in order for the function to work properly.

 

def omulti (num1,num2):

multi=num1*num2  #this line must be idented in order for the function to work properly.

return multi  #this line must be idented in order for the function to work properly.

 

def odiv (num1,num2):

div=num1/num2

return div

 

def orem(num1,num2):

rem= num1%num2  #this line must be idented in order for the function to work properly.

return rem  #this line must be idented in order for the function to work properly.

 

 

num1 = int(input(“Give me a number: “)) 

num2 = int(input (“Give me another number: “))

 

su=osuma(num1,num2)

res=oresta(num1,num2)

mult=omulti(num1,num2)

di=odiv(num1,num2)

re=orem(num1,num2)

 

print (“The sum of your numbers is”, su) 

print (“The difference of your numbers is”, res) 

print (“The product of your numbers is”, mult) 

print (“The division of your numbers is”, int(di)) 

print(“The remainder of the division of your numbers is”, int(re)) 

CC BY 4.0 #TC1014 #WSQ08 On to functions by Gilberto Rogel García is licensed under a Creative Commons Attribution 4.0 International License.

Comments are closed.