Advertisement
Guest User

Untitled

a guest
Jul 24th, 2014
199
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.63 KB | None | 0 0
  1. def hello():
  2.     print('Hello!')
  3.  
  4. def area(width, height):
  5.     return width * height
  6.  
  7. def print_welcome(name):
  8.     print('Welcome,', name)
  9.  
  10. def positive_input(prompt):
  11.     number = float(input(prompt))
  12.     while number <= 0:
  13.         print('Must be a postive number')
  14.         number = float(input(prompt))
  15.     return number
  16.        
  17. name = input('Your Name: ')
  18. hello()
  19. print_welcome(name)
  20. print()
  21. print('To find the area of a rectangle,')
  22. print('enter the width and height below.')
  23. print()
  24. w = positive_input('Width: ')
  25. h = positive_input('Height: ')
  26.  
  27. print('Width =', w, ' Height =', h, ' so Area =', area(w, h))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement