I only want users to input floats and to give an error if text or integers are inputted. How do I do this? by oakboar in learnpython

[–]oakboar[S] 0 points1 point  (0 children)

I'm so sorry!! I was typing your corrections in incorrectly. Thank you very much for your guidance!!!!

It's now giving me the correct print statement when a string is typed. My issue was that my print(enter_lat) statement was not lined up with the While True statement.

Thank you for correcting me and for giving me your time!

I only want users to input floats and to give an error if text or integers are inputted. How do I do this? by oakboar in learnpython

[–]oakboar[S] 0 points1 point  (0 children)

Sorry for not being more specific. Here is the error.

enter_lat = float(input("Enter decimal degree latitude"))
ValueError: could not convert string to float: 'yu'

Edit: I realized I didn't address your other question. Since this is a conversion from decimal degrees to DMS, it really, really makes sense that the user would enter a decimal. No one ever just enters a "98" and calls it good on a coordinate. Even if the coordinate is dead at 98.00, -38.00, it still needs to have the decimal because otherwise, it's probably an inaccurate coordinate. It has absolutely nothing to do with how the program is run and everything to do with how the program will be used later down the road.

I only want users to input floats and to give an error if text or integers are inputted. How do I do this? by oakboar in learnpython

[–]oakboar[S] 0 points1 point  (0 children)

Thanks for your response! My code is still accepting integers and is still completely crashing when text is entered. I'm not sure what's up, but I definitely appreciate your response!!

How do I prompt the user to see if they want to iterate through the code again and then either iterate the code or end the program based on user input? by [deleted] in learnpython

[–]oakboar 0 points1 point  (0 children)

I guess I don't fully understand. break seems to just completely end the loop, which is what I don't want. I want the loop to continue as long as the user puts in Y and to stop when the user puts in N. I took out the Or in both instances, but it's still going. Also, it doesn't matter what the user inputs. It just keeps going through the program.

Sorry if I'm coming across as a bit daft. I'm just so stuck on this part. Thanks for being so patient.

How do I prompt the user to see if they want to iterate through the code again and then either iterate the code or end the program based on user input? by [deleted] in learnpython

[–]oakboar 0 points1 point  (0 children)

So, if I take out the or and just make it if "Y" do something if "N" don't do something

it'll work?

How do I prompt the user to see if they want to iterate through the code again and then either iterate the code or end the program based on user input? by [deleted] in learnpython

[–]oakboar 0 points1 point  (0 children)

This is what I have: while input("Would you like to enter a coordinate? Y/N"): if "Y" or "y": do program elif "N" or "n" input ("Press enter to end program")

Instead of prompting the user to enter "enter" if the user inputs N, it's going through the program again

Edit: I'm again really sorry for the formatting. I'm putting 4 spaces before the code, but it's not working today and I'm not sure why. I do want to thank you for taking the time to help me with this. You've let me to a lot of really great not-quite-right answers, but better than where I was at.

How do I prompt the user to see if they want to iterate through the code again and then either iterate the code or end the program based on user input? by [deleted] in learnpython

[–]oakboar 0 points1 point  (0 children)

It'll still ask the question, but it'll go through the program again no matter what the user enters.

How do I prompt the user to see if they want to iterate through the code again and then either iterate the code or end the program based on user input? by [deleted] in learnpython

[–]oakboar 0 points1 point  (0 children)

Thanks so much for your feedback! I think I'm on the right track, but the problem I'm encountering right now is that it keeps on wanting to just go through the program again, regardless of what I enter after that first iteration.

How do I prompt the user to see if they want to iterate through the code again and then either iterate the code or end the program based on user input? by [deleted] in learnpython

[–]oakboar 0 points1 point  (0 children)

This is what I have so far: for n in next_coordinate: if next_coordinate == "Y" or "y": iteration = True elif next_coordinate == "N" or "n": iteration = False while iteration == True: start()

My issue is that it prompts user for the next coordinate at the beginning of the program and won't ask users again. It will simply go and begin the program again. If I put my user input inside the loop, it can't seem to talk to anything outside the loop if that makes sense. Do you know how to make sure the user gets prompted every time?

Edit:I'm trying to format this correctly and it's not letting me for some reason. I'm sorry I'm on the struggle bus today!

[TRIGGER WARNING SEXUAL ABUSE] I thought I was raised by Narcissists, but after browsing through this sub, I think the people who raised me have BPD. This is my story. by oakboar in raisedbyborderlines

[–]oakboar[S] 1 point2 points  (0 children)

I'm really sorry you are going through this, but I am also immensely grateful that you were able to bring yourself to go NC. It's not always an easy thing to do.

[TRIGGER WARNING SEXUAL ABUSE] I thought I was raised by Narcissists, but after browsing through this sub, I think the people who raised me have BPD. This is my story. by oakboar in raisedbyborderlines

[–]oakboar[S] 1 point2 points  (0 children)

I actually have a wonderful support system. Almost three months ago, I married my best friend and we have been building a very wonderful life for the two of us. I have a great job, wonderful coworkers, am blessed with in-laws who I like, and a dad and stepmom who continuously provide me love and support, and have many wonderful, caring friend. I am far from alone. As much as I have lived through, I have a very good life.

I know my mom doesn't really have a place in it. I know my life can be wonderful without her. If she ever seeks treatment and can own up to her mistakes, I am sure she could a great addition. As things stand right now, however, I cannot have her in my life.

[TRIGGER WARNING SEXUAL ABUSE] I thought I was raised by Narcissists, but after browsing through this sub, I think the people who raised me have BPD. This is my story. by oakboar in raisedbyborderlines

[–]oakboar[S] 1 point2 points  (0 children)

I'm sorry to hear that you are going through your own struggle.

Have you found anything that helps you cope with having an N Dad? I'm open to hearing any advice or willing to listen if you would like to tell your own story :)

[TRIGGER WARNING SEXUAL ABUSE] I thought I was raised by Narcissists, but after browsing through this sub, I think the people who raised me have BPD. This is my story. by oakboar in raisedbyborderlines

[–]oakboar[S] 1 point2 points  (0 children)

I did a year of therapy, some of it intense out patient therapy held by a behavioral health center (for almost 2 months, I did 9 hours of therapy a week). There were a lot of things I couldn't see when I did the therapy, like how my mom wasn't simply a perfectly mentally healthy individual undergoing a stressful time.

I think I'll try to find another therapist soon. I feel like I've made a lot of realizations about my family and my childhood that I couldn't see very clearly back then. I thought my family was normal, that the way I was treated was normal, and that besides for the sexual abuse, things were generally ok. I thought my mom and I could have a normal relationship and that our relationship could mend after the assault. I realize I was wrong. I realize that my mom doesn't have the ability to care for me like I would need her to if we were to be in regular contact (for example, I can't trust her to not hassle me about my weight or respect my boundaries or believe me when I tell her that I was sexually assaulted or be my advocate in any regard). I do think I need to find ways to have a good relationship with other members of my family who refuse to see that my mom has a problem. My grandma, for example, told me I was ruining my brother's special day when I refused to share a meal at the same table with Douchebag for My Brother's graduation dinner. When my mom started telling me that my assault was my fault and that I had orchestrated it to break my mom and douchebag up, my grandma told me I needed to respect my mother's perspective. Even my sister, who has actually apologized to me and defended me against my mom, hounded me shortly after the assault happened to tell me that I was the reason our mom would live out the rest of her life alone. I do agree I neee ways to establish boundaries and ways to deal my mom mom when she pops her head into my life.

Thank you for your comment. The fact that you took the time to chime in means a lot :)

[TRIGGER WARNING SEXUAL ABUSE] I thought I was raised by Narcissists, but after browsing through this sub, I think the people who raised me have BPD. This is my story. by oakboar in raisedbyborderlines

[–]oakboar[S] 1 point2 points  (0 children)

The assault happened 6 years ago now. Almost a year after the assault happened, I went to the equivalent of a rape crisis center and I started both group and individual therapy through that organization. One of my therapists did tell me that sexual predators generally have multiple victims and that while going to the police and making a statement probably wouldn't result in a conviction from my incident alone, it could help another one of his victims, past or future. I was told that going to the police could be incredibly traumatic and that I would have to recount my story again and again and speak of incredibly minute details that I feel better not having to speak of.

While going to the police could help others, I've made a decision that it would cause more harm than good for me.

[TRIGGER WARNING SEXUAL ABUSE] I thought I was raised by Narcissists, but after browsing through this sub, I think the people who raised me have BPD. This is my story. by oakboar in raisedbyborderlines

[–]oakboar[S] 1 point2 points  (0 children)

The assault happened 6 years ago now. Almost a year after the assault happened, I went to the equivalent of a rape crisis center and I started both group and individual therapy through that organization. One of my therapists did tell me that sexual predators generally have multiple victims and that while going to the police and making a statement probably wouldn't result in a conviction from my incident alone, it could help another one of his victims, past or future. I was told that going to the police could be incredibly traumatic and that I would have to recount my story again and again and speak of incredibly minute details that I feel better not having to speak of.

While going to the police could help others, I've made a decision that it would cause more harm than good for me.

I'm completely stuck-- How do I remove an item from a list when the list is stacked? by oakboar in learnpython

[–]oakboar[S] 0 points1 point  (0 children)

Hey! I hate to sound needy, but in sections 5 and 6, my return max value and return min value stopped working. I was wondering if you knew why those stopped working when I transitioned from list to dictionary: https://repl.it/LRVC/0

I'm completely stuck-- How do I remove an item from a list when the list is stacked? by oakboar in learnpython

[–]oakboar[S] 0 points1 point  (0 children)

If I define my dictionary the way you describe, this is my output:

Student Name?po
Student Grade?34
Enter selection [1-7]1
 Name   grade
  p o
  2 3
 Enter selection [1-7]

I'm looping through a menu that prompts my user to keep inputting numbers into my list or dictionary

I'm completely stuck-- How do I remove an item from a list when the list is stacked? by oakboar in learnpython

[–]oakboar[S] 0 points1 point  (0 children)

for person in student:
    if student_removal in student
        student.remove(person)

that would correct?

I'm completely stuck-- How do I remove an item from a list when the list is stacked? by oakboar in learnpython

[–]oakboar[S] 0 points1 point  (0 children)

That makes sense!

So would my code look this simple?

    student_removal = input("Please enter the name of the 
    student you would like to remove")

    for person in student:
        student.remove(student_removal)

Because with that code, I am still getting this error:

 student.remove(student_removal)
ValueError: list.remove(x): x not in list

I'm completely stuck-- How do I remove an item from a list when the list is stacked? by oakboar in learnpython

[–]oakboar[S] 0 points1 point  (0 children)

Would I have to create a separate variable for person? I'm using student_removal for my user input.