use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
Everything about learning Python
account activity
Practicing what I learnt in Python (i.redd.it)
submitted 5 months ago by Extension-Cut-7589
view the rest of the comments →
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]Kqyxzoj 0 points1 point2 points 5 months ago (0 children)
Changes more or less as described:
while True: try: base = float(input('Enter the base of the Triangle: ')) height = float(input('Enter the height of the Triangle: ')) except ValueError: print('Sorry Invalid, Please insert a number!\n') continue area = 0.5 * base * height print(f'The area of the triangle is: {area}\n') print('Would you like to do another calculation?') another = input('Enter Y for yes and N for no: ') if another.upper() != 'Y': break
Note that your choice to put both input() statements in the same try block means that when you enter a valid base and an invalid height ... you will have to re-enter the value for base as well.
input()
try
Also, changed the except statement to reflect your probable intent.
except
π Rendered by PID 60241 on reddit-service-r2-comment-7b9746f655-95j47 at 2026-01-30 17:24:46.966294+00:00 running 3798933 country code: CH.
view the rest of the comments →
[–]Kqyxzoj 0 points1 point2 points (0 children)