lab 2

Instructions:

Write a program that asks the user to enter two integer numbers x and y. The program should perform the following operations and display the results back:

1-      The sum x + y

2-      The difference x – y

3-      The product x * y

4-      The quotient x/y

5-      The remainder x%y

6-      Whether x is less than, equal, or greater than y

 

After displaying the results, the program should ask again for two integer numbers and repeat the operations for the new values entered. If either the value of x or y entered by the user is 0 (zero), the program should finish.

 

On your OpenLab portfolio post the following items, following the Lab Report Example:

  • Lab description and your experience in your own words.
  • Copy/paste of the code you typed, properly formatted.
  • Screenshots of your results.

x= input ('Enter the value of x')
y= input('enter the value of y:')
print 'Enter 1 to sum x and y'
print 'Enter 2 to subtract x from y'
z = ('Enter selection: ')

if z==1
results = x+y
print 'The sum of x and y is:', x+y

lab 1

Instructions:

Install Python

  • Go to http://python.org, click on the Download tab, and select the appropriate version based on your operating system.
  • After download, install python on your computer.
  • Get familiar with python by reading the documentation on the site (The tutorial is an good starting point http://docs.python.org/3/tutorial/)
  • Complete Exercise 2 and Exercise 3 from chapter 2 of the python book.
  • After completing Exercises 2 and 3, post into your OpenLab portfolio the following items:
    • Lab description and your experience doing it in your own words.
    • Screenshots of the code you typed.
    • Screenshots of the results you got.
    • https://mail.google.com/mail/?ui=2&ik=8ae8e88c3e&view=att&th=13d02d87d6b29078&attid=0.1&disp=safe&realattid=f_hdhlct7a0&zw

Raymond Barimah
Lab 2 variables
section 9304
2/19/13

import math
radiusstring = input (“Enter the radius”)
radiusfloat = float (radiusstring)
area = math * pi * radiusfloat * radiusfloat
print (“The area of a circle with the radius is”) area
Enter the radius of the circle: 4
area = 50.24

Enter the radius of the circle:3
area= 28.26
Enter the radius of the circle:6
area= 113.04
Enter the radius of the circle:10
area= 62.83

input (” input two set of points (4, 3) and (10, 6) “)
D = squrt (x2-x1)**2 + (y2-y1)**2
print “The distance of the points (4,3) and (10,6) is 6.708

Hello world!

This is the first post on your Learning Blog. Edit or delete it, then start blogging!

NOTE: Remember to add appropriate Category and Tags to your posts. This will help your professors and other visitors find the content they are looking for. The Category “Coursework” and the Tags “OpenLab” and “City Tech” have already been applied to this post. Feel free to make changes!