This lab manual contains around 25 python programs along with its pseudocode/algorithm and output. The python programs comprise of all the most important basic concepts in Python from arithmetic operations, string operations, string functions, basic functions, if -else blocks to looping. The codes ...
,[Ex. No. M1_CSQ1]
AIM
To calculate the age of a housefly in seconds, given the number of days the housefly lived.
Algorithm / Pseudocode
Step 1: READ days
Step 2: COMPUTE the product of days, 24 and 3600 and store the value in age
Step 3: PRINT age
Flowchart
Program Code
days=int(input())
age=(days*24)*3600
print(age)
Output
, [Ex. No. M1_CSQ2]
AIM
To input two complex numbers and add the same to produce the result. After producing the
result, print the real part and imaginary part separately.
Algorithm/Pseudocode
Step 1: READ n
Step 2: Declare two lists listl[] and listml[]
Step 3: for i in range (0,n):
READ l and ml
Add l to listl and ml to listml using append()
Step 4: INITIALIZE total and totalml with 0
Step 5: for j in range (0,n):
COMPUTE the sum of totall and value of listl[j] and store in totall
COMPUTE the sum of totalml and value of listml[j] and store in totalml
Step 6: if(totalml>1000):
COMPUTE the quotient of totalml divided by 1000 and store in m
COMPUTE the sum of totall and m and store in totall
COMPUTE the difference between totalml and product of m and 1000 and store
totalml
Step 7: PRINT ("{} litres {} ml".format(totall,totalml))
Flowchart
The benefits of buying summaries with Stuvia:
Guaranteed quality through customer reviews
Stuvia customers have reviewed more than 700,000 summaries. This how you know that you are buying the best documents.
Quick and easy check-out
You can quickly pay through credit card or Stuvia-credit for the summaries. There is no membership needed.
Focus on what matters
Your fellow students write the study notes themselves, which is why the documents are always reliable and up-to-date. This ensures you quickly get to the core!
Frequently asked questions
What do I get when I buy this document?
You get a PDF, available immediately after your purchase. The purchased document is accessible anytime, anywhere and indefinitely through your profile.
Satisfaction guarantee: how does it work?
Our satisfaction guarantee ensures that you always find a study document that suits you well. You fill out a form, and our customer service team takes care of the rest.
Who am I buying these notes from?
Stuvia is a marketplace, so you are not buying this document from us, but from seller srijaniray. Stuvia facilitates payment to the seller.
Will I be stuck with a subscription?
No, you only buy these notes for $8.99. You're not tied to anything after your purchase.