#🔒 Not sure if im missing something

31 messages · Page 1 of 1 (latest)

lilac badger
#

a= int(input("Your age:21"))
r= int(input("Your resting heart rate:68"))
Training_Heart_Rate = (0.7 * (220 - a) + 0.3 * r)
print(f"Your training heart rate is {Training_Heart_Rate} bpm")

Im doing class work and im very new to python. here a example of what it should put out
Enter your age: 20
Enter your resting heart rate: 70
Training heart rate: 161 beats/min.

what happening is only giving me the age
"Your age:21"

echo lichenBOT
#

@lilac badger

Python help channel opened

Remember to:

  • Ask your Python question, not if you can ask or if there's an expert who can help.
  • Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
  • Explain what you expect to happen and what actually happens.

:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.

glass stream
#

how are you running the code?

lilac badger
cedar hill
#

ok well there is a glaring issue

#

you copied the exact example output into your input prompts

#

you shouldn't include what the user has entered in the example

#

then, you actually have to enter a number and press enter to continue on from the input

lilac badger
#

the example is from the text book. I was trying to use my age and a random heart rate to get a rpm

#

wasnt trying to use the same number as the example given

cedar hill
#

you pasted the user input from the example as part of your prompts

#
a = int(input("Your age:21"))
#                       ^^
#

the prompt should end in ": "

lilac badger
#

I appraicted the help, im slow 💀

when following what you address it prompt a window to type which i did and the final result i got was

Your age:21
Your resting heart rate:68
Your training heart rate is 159.7 bpm

#

thank you for the help and sorry for bothering you ❤️

cedar hill
#

perfect

#

now, for formatting

#

it looks better if you put a space after the : in the prompt

#

so then in the terminal an input will look like Your age: 21, with a space before 21

#
a = int(input("Your age: "))
#                       ^
#

especially since the example you posted has spacing

lilac badger
#

agree it does look better with the space didnt thought of it. I appratice the help. was so confuse why it wasnt giving the output when i put the number down and didnt thought about the output i want was messing with my input promt

cedar hill
#

||*appreciate||

cedar hill
#

!e

import sys
import io

sys.stdin = io.StringIO("12")
x = int(input("Enter a number: 87"))
print()
print(x)
echo lichenBOT
#

@cedar hill :white_check_mark: Your 3.12 eval job has completed with return code 0.

001 | Enter a number: 87
002 | 12
cedar hill
#

see that the input still look the 12 no problem

lilac badger
#

yeah

#

thank you for the advice and helping me notice my mistake ❤️

echo lichenBOT
#
Python help channel closed

This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.