Advertisement
Guest User

Untitled

a guest
Sep 1st, 2018
134
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 2.07 KB | None | 0 0
  1. print("How old are you?", end=' ')
  2. age = input()
  3. print("How tall are you?", end=' ')
  4. print("How much do you weigh?", end=' '
  5. weight = input()
  6.  
  7. print(f"So, you're {age} old, {height} tall and {weight} heavy.")
  8.  
  9. script, filename = argv
  10.  
  11. txt = open(filenme)
  12.  
  13. print("Here's your file {filename}:")
  14. print(tx.read())
  15.  
  16. print("Type the filename again:")
  17. file_again = input("> ")
  18.  
  19. txt_again = open(file_again)
  20.  
  21. print(txt_again_read())
  22.  
  23.  
  24. print('Let's practice everything.')
  25. print('You\'d need to know \'bout escapes
  26.      with \\ that do \n newlines and \t tabs.')
  27.  
  28. poem = """
  29. \tThe lovely world
  30. with logic so firmly planted
  31. cannot discern \n the needs of love
  32. nor comprehend passion from intuition
  33. and requires an explanation
  34. \n\t\twhere there is none.
  35. """
  36.  
  37. print("--------------)
  38. print(poem)
  39. print(--------------")
  40.  
  41.  
  42. five = 10 - 2 + 3 -
  43. print(f"This should be five: {five}"
  44.  
  45. def secret_formula(started)
  46.     jelly_beans = started * 500
  47.     jars = jelly_beans / 1000
  48.     crates = jars  100
  49.     return jelly_beans, jars, crates
  50.  
  51.  
  52. start_point = 10000
  53. beans, jars = secret_formula(start_point)
  54.  
  55. # remember that this is another way to format a string
  56. print("With a starting point of: {}".format(start_point))
  57. # it's just like with an f"" string
  58. print(f"We'd have {beans} beans, {jars} jars, and {crates} crates.")
  59.  
  60. start_point = start_point / 10
  61.  
  62. print("We can also do that this way:")
  63. formula = secret_formula(startpoint)
  64. # this is an easy way to apply a list to a format string
  65. print("We'd have {} beans, {} jars, and {} crates.".format(*formula))
  66.  
  67.  
  68.  
  69. people = 20
  70. cates = 30
  71. dogs = 15
  72.  
  73.  
  74. if people < cats:
  75.     print "Too many cats! The world is doomed!"
  76.  
  77. if people < cats:
  78.     print("Not many cats! The world is saved!")
  79.  
  80. if people < dogs:
  81.     print("The world is drooled on!")
  82.  
  83. if people > dogs
  84.     print("The world is dry!")
  85.  
  86.  
  87. dogs += 5
  88.  
  89. if people >= dogs:
  90.     print("People are greater than or equal to dogs.")
  91.  
  92. if people <= dogs
  93.     print("People are less than or equal to dogs.)
  94.  
  95.  
  96. if people = dogs:
  97.    print("People are dogs.")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement