A controlled ageing system in Python EDIT: Wrong place, sorry [closed]
If someone can delete this I put it on the wrong website! I didn't realise I was logged into stack exchange and not stack overflow... sorry guys.
I'm an absolute beginner to python, this is my first go at coding, so forgive me if i'm being an idiot.
I decided to have a go at making my own life simulator similar to BitLife, available on the app store. I ran into a problem with the ageing system, the goal is that each time the user presses 'a' it adds a year to their Age.
I'm not sure if it's actually simple and i'm missing something obvious, but here's what I have, it makes sense in my head:
def waiting():
def runAge():
NewAge = Age + 1
print( str(NewAge) + ' years old.')
NewAge = Age
waiting()
yearup = input()
if yearup == 'a':
runAge()
waiting()
My thinking is that there is a waiting state where nothing should happen, when the program waits for the 'a' control, where it begins the ageing process, in which it adds 1 to the Age value. (I set this to be 0 earlier.) Then that is called NewAge which is then renamed Age, so that it can be done again.
The issue is when I test it, it only prints '1' each time I press a. It makes sense in my head, have I missed something? Am I over complicating? Thanks.
python
New contributor
closed as off-topic by πάντα ῥεῖ, Gareth Rees, janos, 200_success, Sᴀᴍ Onᴇᴌᴀ Dec 15 at 14:04
This question appears to be off-topic. The users who voted to close gave this specific reason:
- "Code not implemented or not working as intended: Code Review is a community where programmers peer-review your working code to address issues such as security, maintainability, performance, and scalability. We require that the code be working correctly, to the best of the author's knowledge, before proceeding with a review." – Gareth Rees, janos, 200_success, Sᴀᴍ Onᴇᴌᴀ
If this question can be reworded to fit the rules in the help center, please edit the question.
add a comment |
If someone can delete this I put it on the wrong website! I didn't realise I was logged into stack exchange and not stack overflow... sorry guys.
I'm an absolute beginner to python, this is my first go at coding, so forgive me if i'm being an idiot.
I decided to have a go at making my own life simulator similar to BitLife, available on the app store. I ran into a problem with the ageing system, the goal is that each time the user presses 'a' it adds a year to their Age.
I'm not sure if it's actually simple and i'm missing something obvious, but here's what I have, it makes sense in my head:
def waiting():
def runAge():
NewAge = Age + 1
print( str(NewAge) + ' years old.')
NewAge = Age
waiting()
yearup = input()
if yearup == 'a':
runAge()
waiting()
My thinking is that there is a waiting state where nothing should happen, when the program waits for the 'a' control, where it begins the ageing process, in which it adds 1 to the Age value. (I set this to be 0 earlier.) Then that is called NewAge which is then renamed Age, so that it can be done again.
The issue is when I test it, it only prints '1' each time I press a. It makes sense in my head, have I missed something? Am I over complicating? Thanks.
python
New contributor
closed as off-topic by πάντα ῥεῖ, Gareth Rees, janos, 200_success, Sᴀᴍ Onᴇᴌᴀ Dec 15 at 14:04
This question appears to be off-topic. The users who voted to close gave this specific reason:
- "Code not implemented or not working as intended: Code Review is a community where programmers peer-review your working code to address issues such as security, maintainability, performance, and scalability. We require that the code be working correctly, to the best of the author's knowledge, before proceeding with a review." – Gareth Rees, janos, 200_success, Sᴀᴍ Onᴇᴌᴀ
If this question can be reworded to fit the rules in the help center, please edit the question.
add a comment |
If someone can delete this I put it on the wrong website! I didn't realise I was logged into stack exchange and not stack overflow... sorry guys.
I'm an absolute beginner to python, this is my first go at coding, so forgive me if i'm being an idiot.
I decided to have a go at making my own life simulator similar to BitLife, available on the app store. I ran into a problem with the ageing system, the goal is that each time the user presses 'a' it adds a year to their Age.
I'm not sure if it's actually simple and i'm missing something obvious, but here's what I have, it makes sense in my head:
def waiting():
def runAge():
NewAge = Age + 1
print( str(NewAge) + ' years old.')
NewAge = Age
waiting()
yearup = input()
if yearup == 'a':
runAge()
waiting()
My thinking is that there is a waiting state where nothing should happen, when the program waits for the 'a' control, where it begins the ageing process, in which it adds 1 to the Age value. (I set this to be 0 earlier.) Then that is called NewAge which is then renamed Age, so that it can be done again.
The issue is when I test it, it only prints '1' each time I press a. It makes sense in my head, have I missed something? Am I over complicating? Thanks.
python
New contributor
If someone can delete this I put it on the wrong website! I didn't realise I was logged into stack exchange and not stack overflow... sorry guys.
I'm an absolute beginner to python, this is my first go at coding, so forgive me if i'm being an idiot.
I decided to have a go at making my own life simulator similar to BitLife, available on the app store. I ran into a problem with the ageing system, the goal is that each time the user presses 'a' it adds a year to their Age.
I'm not sure if it's actually simple and i'm missing something obvious, but here's what I have, it makes sense in my head:
def waiting():
def runAge():
NewAge = Age + 1
print( str(NewAge) + ' years old.')
NewAge = Age
waiting()
yearup = input()
if yearup == 'a':
runAge()
waiting()
My thinking is that there is a waiting state where nothing should happen, when the program waits for the 'a' control, where it begins the ageing process, in which it adds 1 to the Age value. (I set this to be 0 earlier.) Then that is called NewAge which is then renamed Age, so that it can be done again.
The issue is when I test it, it only prints '1' each time I press a. It makes sense in my head, have I missed something? Am I over complicating? Thanks.
python
python
New contributor
New contributor
edited Dec 15 at 15:19
New contributor
asked Dec 15 at 12:41
JumpJehovah
11
11
New contributor
New contributor
closed as off-topic by πάντα ῥεῖ, Gareth Rees, janos, 200_success, Sᴀᴍ Onᴇᴌᴀ Dec 15 at 14:04
This question appears to be off-topic. The users who voted to close gave this specific reason:
- "Code not implemented or not working as intended: Code Review is a community where programmers peer-review your working code to address issues such as security, maintainability, performance, and scalability. We require that the code be working correctly, to the best of the author's knowledge, before proceeding with a review." – Gareth Rees, janos, 200_success, Sᴀᴍ Onᴇᴌᴀ
If this question can be reworded to fit the rules in the help center, please edit the question.
closed as off-topic by πάντα ῥεῖ, Gareth Rees, janos, 200_success, Sᴀᴍ Onᴇᴌᴀ Dec 15 at 14:04
This question appears to be off-topic. The users who voted to close gave this specific reason:
- "Code not implemented or not working as intended: Code Review is a community where programmers peer-review your working code to address issues such as security, maintainability, performance, and scalability. We require that the code be working correctly, to the best of the author's knowledge, before proceeding with a review." – Gareth Rees, janos, 200_success, Sᴀᴍ Onᴇᴌᴀ
If this question can be reworded to fit the rules in the help center, please edit the question.
add a comment |
add a comment |
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes