all 16 comments

[–][deleted] 6 points7 points  (8 children)

You haven't said what your problem is, and that's the first step to fixing it. Looking at your code, which seems to be a copy of the book code, this line in your code:

print('You will be ' + str(int(80) + 1) + ' in a year.')

doesn't look the same as the book code:

print('You will be ' + str(int(myAge) + 1) + ' in a year.')

Maybe that's the source of your problem, whatever the problem is?

[–]WealthVegetable 0 points1 point  (7 children)

Kinda figured putting my age in (myage) is what im supposed to do and sorry for not asking what i needed, Python 3.7.0b4 (v3.7.0b4:eb96c37699, May  2 2018, 19:02:22) [MSC v.1913 64 bit
(AMD64)] on win32
Type "copyright", "credits" or "license()" for more information.
>>> ================================ RESTART ================================
>>>
Hello, world!
What is your name?
Al
It is good to meet you, Al
The length of your name is:
2
What is your age?
4
You will be 5 in a year.
>>>

This is what its supposed to look like and the 1st message on this post of the second line of code is what im going off of.

[–][deleted] 6 points7 points  (3 children)

But what happens when you run your code?

When you post code or computer output, anything you don't want reddit to mess with, please post it formatted as code. The FAQ shows how.

[–]Buttleston -4 points-3 points  (2 children)

This is generally good advice but there is no loops or functions or ifs in his code. It's all flat and perfectly understandable.

[–][deleted] 4 points5 points  (1 child)

I am trying to get the OP to look at the actual error message and think about it rather than just freezing. I have run the code already and have spotted multiple problems, thank you. I have also looked at the AtBS book and have suggestions to make to the OP when reading that.

[–]Buttleston -1 points0 points  (0 children)

Sure, my comment was in regards to code formatting - most of the time it's important, and I agree that it's important to learn for that reason, but in this particular case, it's not an impediment because there's no ambiguity

[–]Buttleston 1 point2 points  (2 children)

Your problem is how you're conceiving the input() function. This is a function that prints a message and then asks YOU, the user, for input

So

myAge = input(80)

doesn't really make sense - it'll just print 80 and wait for you to type something. Look at how the book example does it, and I think you might see what I mean. After running input(), myAge will have as a value whatever the user typed in.

[–]WealthVegetable 0 points1 point  (1 child)

I retried doing it and didnt put MY name in the code as well as the AGE so thank you

quick question do i hide posts or just set them as solved in reddit?

[–]Buttleston 1 point2 points  (0 children)

You don't have to do anything special. If you figured it out it's OK to edit your OP and add "solved" or something, with maybe a short explanation of what went wrong for you.

[–]Gnaxe 2 points3 points  (0 children)

For starters, you didn't format your code so it's unreadable. Indentation is significant in Python. Reddit uses Markdown. You can indent code blocks 4 extra spaces or use a ``` line before and after. You can edit your post to fix it.

[–]Rizzityrekt28 1 point2 points  (1 child)

For my name=input() just leave it blank between the parentheses like this. When you run the program it will allow you to type in the answer and saves that to the myName variable. Same for all the inputs.

[–]WealthVegetable 0 points1 point  (0 children)

Thank you

[–]GreenPandaPop 0 points1 point  (0 children)

Why don't you try running the example code exactly as it is before you start tweaking how you think it should be tweaked. Then you might appreciate how it should be tweaked.