Data Driven Decision Making

B.Com Business Analytics

Sem I

Questions (6-10) : Python

 

Q6. Write a program to assign three values to the variables a, b and c 

        and perform the operations addition, multiplication, ((a+b)+c), 

        ( a-(b+c)), (a*(b+c)), (a + (b*c)), (a*(b-c)).

        #Write a program to assign three values to the variables a, b and c 

  and perform the operations addition, multiplication, ((a+b)+c),

  (a-(b+c)), (a*(b+c)), (a + (b*c)), (a*(b-c)).

   a = int(input('Enter a number of your choice'))    

    b= int(input('Enter a number of your choice'))

    c= int(input('Enter a number of your choice'))

    print(a+b)

    print("(a+b)+c)=  ", (a+b)+c)

    print("a-(b+c)= ", a-(b+c))

    print("a*(b+c)= ", a*(b+c))

    print("a+(b*c)= ", a+(b*c))

    print("a*(b-c)= ", a*(b-c))



Q7. Write a program to find the maximum and minimum of the given list of numbers.

    #To find the maximum and minimum of numbers

    L1 = [45,56,24,13,68,74,45,10,9,100,78,32,12,90,15]

    print("maximum of the given number is :",max(L1))

    print("minimum of the given numbers is :",min(L1))



 

Q8. Write a program to insert two numbers and print the maximum number.

    #To find the maximum and minimum of the numbers

    a= int(input('enter a number of your choice'))

    b= int(input('enter a number of your choice'))

    if (a>b):

      print(a)

    else :

        print(b)



or

    #To find the maximum and minimum of the numbers
    a =input('enter a number of your choice')
    b=input('enter a number of your choice')
    maximum=max(a,b)
    minimum=min(a,b)
    print("Maximum =" ,maximum)
    print("Minimum =", minimum)



Q9. Write a program to insert a number and print “You entered an even number

      if the number is even and “You entered an Odd number” if the entered number is odd.

        #Ask the user for a number .if the number is even , print "You picked an Even number" and if it is odd,print"You picked an odd number"

    Num = int(input('enter any integer number'))

    if(Num%2==0):

      print("you picked an even number")

    else:

      print("you picked an odd number")


Q10. Write a program to print the multiplication table of the number of users choice.

    #Multiplication table

    number = int(input ("Enter the number for which you want to print the multiplication table: "))      

    # We are using "for loop" to iterate the multiplication 10 times       

    print ("The Multiplication Table of: ", number)    

    for count in range(111):      

    print (number, 'x', count, '=', number * count)

 

            



 

 





 

 

Comments

Popular posts from this blog