









Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
First assignment basics for any non technical students
Typology: Assignments
1 / 15
This page cannot be seen from the preview
Don't miss anything!










TITLE: Operators (Arithmetic, Relational, Logical and Ternary operators) Aim: Understanding the functions of operators in python. Software Required: IDLE3.9.7 MICROSOFT WORD. EXERCISE 1:
Step1-start Step2-get the values of a and b Step3-c=a+b Step4-display c Step5- d=ab Step6- display d Step7-e=a/b Step8- display e Step9-f=a%b Step10- display f Step11-g=a*b Step12- display g Step13-h=a//b Step14- display h
power=n1**n floor=n1//n print(sum,mult,div,rem,power,floor) EXERCISE 2:
1)Initial amount 2)No of Years 3)Expected Matured Amount. Rate of interest PROCESSING REQUIRED: ALTERNATE SOLUTION:
Step1: Start Step2: Get the values of a,b and c Step3: Initialize a new variable d Step4: d= ((c-a)/(ab)) Step5: display d CODE: #Print rate of interest a=int(input("Initial amount"))
Items Quantity Price Total Amount PROCESSING REQUIRED: ALTERNATE SOLUTION: Total Cost:Addition of(price of item * quantity of item) None ALGORITHM: Step1:Start Step2:Get the Values of q1,q2,q3andp1,p2,p3. Step3:Total=(q1p1)+(q2p2)+(q3*p3) Step4:Display Total. Code: q1=int(input("Enter the quantity of bread bought")) p1=float(input("Enter the price")) q2=int(input("Enter the quantity of butter bought")) p2=float(input("Enter the price"))
q3=int(input("Enter the quantity of jam bought")) p3=float(input("Enter the price")) tot_price=q1p1+q2p2+q3*p print("Total amount to pay:",tot_price) EXERCISE 4:
p2=float(input("Enter the price of table")) n3=int(input("Enter the number of chairs")) p3=float(input("Enter the price of chair")) n4=int(input("Enter the number of hours worked by one laborer")) p4=p3=float(input("Enter the wage")) tot_price=n1p1+n2p2+n3p3+n4p4#costs of computer,chairs,table and laborer print("Total amount to pay:",tot_price) EXERCISE 5: Evaluate the following arithmetic operations.
Output:
Output: 5.Syntax for tuple. Output:
6.syntax for list Output: 7.Syntax for Dictionary. Output: INFERENCE: Understandood the functions of operators in python.