Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- print("Hello world!")
- age = 29
- print(age)
- age_text = str(age)
- print("Your age:" + age_text)
- salary = 3500
- print(salary)
- tax = 1.24
- print(tax)
- name = "Some Person"
- print(name)
- total = 153 + 869
- print(total)
- difference = 1234 - 356
- print(difference)
- # increase the salary by 25% => multiply by 1.25
- salary = salary * 1.25
- salary = int(salary)
- print(salary)
- # division with decimals
- wind_speed = 25 / 3.6
- print(wind_speed)
- # division without decimals
- apples = 25 // 4
- print(apples)
- # how many apples was left over, if 25 is divided by 4?
- leftover = 25 % 4
- print(leftover)
- # therefore 4 * 6 = 24, + 1 remainder = 25 apples
- # this is same as salary = salary + 300
- salary += 300
- print(salary)
- # NEW FILE
- salary = 3000
- savings = 2750
- debt = 1275
- total_money = salary + savings - debt
- print(total_money)
- name = "John Doe"
- # easiest way to combine any kind of variable is to
- # use f-strings!
- print(f"Hello {name}! Your balance: {total_money} €")
- # NEW FILE
- # get integer from user, remember to change the input to int!
- # input always gives text at first
- number = input("Give a number: ")
- number = int(number)
- # and get a decimal number from user
- another = input("Give another number: ")
- another = float(another)
- # print the sum
- print(number + another)
Advertisement
Add Comment
Please, Sign In to add comment