Week 4
Rubbish calculator
first_number = int(input("Please give me a whole number: "))
second_number = int(input("Please give me another whole number: "))
result = first_number + second_number
print("The result is:")
print(result)
if result > 100:
print("That was a big number")
When are you 100?
name = input("What is your name: ")
age = int(input("How old are you: "))
year = str((2014 - age)+100)
print(name + " will be 100 years old in the year " + year)
Add new user
username_and_passwords = {'user1': 'password1', 'user2', 'password2'}
user_selection = input("Do you want to add a new user?")
if user_selection.lower() == 'yes':
new_user = input("New username: ")
new_password = input("New password: ")
username_and_passwords[new_user] = new_password
print("Users: ", username_and_passwords.keys())
Last updated