Created
February 27, 2025 08:55
-
-
Save xlvnacyx/8fa87e4dd61edde65a667cc173554a61 to your computer and use it in GitHub Desktop.
I’m learning Python from the very beginning, and it’s been great returning to the basics. But as the early challenges are simple, I’m adding a little flavor to my solutions, to get in a little more practice with the syntax. This is my solution to a challenge where I needed to add two numbers and then multiply them by a third number.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def add_then_multiply(): | |
num1 = int(input('Pick a number and enter it: ')) | |
print('Yes, good.') | |
num2 = int(input('Now, enter another number: ')) | |
num1 += num2 | |
final_num = num1 * 3 | |
if final_num == 69: | |
print(f'You dirty rascal you, your number is {final_num}') | |
else: | |
print(f'The total is {final_num}') | |
add_then_multiply() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment