Advertisement
Morbo

math.py

Apr 18th, 2012
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.11 KB | None | 0 0
  1. from sys import argv
  2.  
  3. script, a, j, x, y = argv
  4. a = int(argv[1])
  5. j = int(argv[2])
  6. x = int(argv[3])
  7. y = int(argv[4])
  8. print('\nSo, today, we\'re gonna try some more math stuff,\nwith the \'argv\' and \'raw_input\' commands, and then write to a file\nour complete results.\nmaybe...\n\n%s' % ('~'*80))
  9. print('\nSo, let\'s start off with those numbers you listed\nwhat were they again?\n\nach, yeah;\n\n%s, %s, %s and %s' % (a, j, x, y))
  10. print('I\'m going to write those to a file first so I don\'t forget them.')
  11. file = raw_input('What should we call it? ')
  12. txt = open(file, 'w')
  13. txt.truncate()
  14. txt.write('First number was: %s\nSecond number was: %s\nThird Number was: %s\nFourth number was: %s' % (a,j,x,y))
  15. txt.close()
  16. print('ok, cool. We got those...let\'s get a few more.')
  17. r1 = int(raw_input('Random number 1: '))
  18. r2 = int(raw_input('Random number 2: '))
  19. r3 = int(raw_input('Random number 3: '))
  20. print("""\nAight, so altogether we\'ve got:
  21. %s, %s, %s, %s, %s, %s, %s.
  22. Right?""" % (a,j,x,y,r1,r2,r3))
  23. print('~'*80)
  24. print('Let\'s do the math. We\'re solving for y.')
  25. print('%s' % int(((((a/r1)*j)+x)*r2)/r3))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement