Sinisterly
Some thing fun I made in seconds - Printable Version

+- Sinisterly (https://sinister.ly)
+-- Forum: Coding (https://sinister.ly/Forum-Coding)
+--- Forum: Python (https://sinister.ly/Forum-Python)
+--- Thread: Some thing fun I made in seconds (/Thread-Some-thing-fun-I-made-in-seconds)



Some thing fun I made in seconds - LoneDevil - 05-03-2013

Code:
multAge = int(input('Multiply the first number of your age by 5 and enter it ' )) addAge = multAge + 3 doubleAge = addAge * 2 Addsecond = int(input('Add the second number of your age ' )) Secondadd = doubleAge + Addsecond age = Secondadd - 6 print(age)

It's the simplest thing ever, however it's still fun. Biggrin


(the math for this: Ask the person to multiply the first number of his or her age by 5.
Tell them to add 3.
Now tell them to double this figure.
Finally, have the person add the second number of his or her age to the figure and ave them tell you their answer.
Deduct 6 and you will have their age.)

Ps. I know the math involved is sorta childish, but yeah I was bored...


RE: Some thing fun I made in seconds - noize - 05-03-2013

Code:
input("Think about a number and press enter...") input("Multiply the number by 9...") input("Deduct 5 from the result...") input("Now sum the digits composing the result...") input("If there are still more than 2 digits sum them until you have a one digit number...") print("... which is 4.")



RE: Some thing fun I made in seconds - noize - 05-03-2013

Code:
input("Think about a number and press enter...") input("Multiply the number by 9...") input("Deduct 5 from the result...") input("Now sum the digits composing the result...") input("If there are still more than 2 digits sum them until you have a one digit number...") print("... which is 4.")



RE: Some thing fun I made in seconds - ArkPhaze - 05-05-2013

It's cool. Smile You should check the input though. Otherwise you could have just done this:
Code:
num1 = (int(input('Multiply the first number of your age by 5 and enter it ' )) + 3) * 2 num2 = int(input('Add the second number of your age ' )) age = num1 + num2 - 6 print(age)



RE: Some thing fun I made in seconds - ArkPhaze - 05-05-2013

It's cool. Smile You should check the input though. Otherwise you could have just done this:
Code:
num1 = (int(input('Multiply the first number of your age by 5 and enter it ' )) + 3) * 2 num2 = int(input('Add the second number of your age ' )) age = num1 + num2 - 6 print(age)



RE: Some thing fun I made in seconds - hellomen - 09-19-2013

Input is already an number so 14 = int 14.00 = float
you're right about it if you are counting it towards even if the user fills out .00 or if it was raw_input = most likely a string


RE: Some thing fun I made in seconds - Deque - 09-20-2013

(09-19-2013, 11:06 PM)hellomen Wrote: Input is already an number so 14 = int 14.00 = float
you're right about it if you are counting it towards even if the user fills out .00 or if it was raw_input = most likely a string

Nope, he is using Python 3 (most likely). And there input() returns a string.


RE: Some thing fun I made in seconds - hellomen - 09-20-2013

(09-20-2013, 07:26 AM)Deque Wrote:
(09-19-2013, 11:06 PM)hellomen Wrote: Input is already an number so 14 = int 14.00 = float
you're right about it if you are counting it towards even if the user fills out .00 or if it was raw_input = most likely a string

Nope, he is using Python 3 (most likely). And there input() returns a string.

Sorry mate I thought it was python 2 my bad I am new in python and I just learned that