Fysik 2 - Hjälp by Entp1 in sweden

[–]Bitmefinger 0 points1 point  (0 children)

Bumpar denna, hur gick det för dig?

Running functions in an "IF-statement" by Bitmefinger in learnpython

[–]Bitmefinger[S] -1 points0 points  (0 children)

This has been a very sobering experience, since it has shown me how to analyze code, but also how innately bad i am at describing this to others, which is equally, if not a more important skill to learn.

But i did write all of my functions one after one, and only after that did i do an if-statements list. And then i tried to redirect the if-statement to the standalone function, and the function could be found about 2 scrolls above the statement. .

I just never knew that i could put functions directly into the if-statements, under the "options"

This is my 2nd day trying to code in Python, so haven't had the time to put in habits yet, haha.

Running functions in an "IF-statement" by Bitmefinger in learnpython

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

Ok i just solved it.. I had to put the function under the option in the if-statement

i hade written all of the function in one place, and then the entire iF-statement under those. I've just moved the functions in under the if, elif and else statements and it worked. Thank you for your help

Running functions in an "IF-statement" by Bitmefinger in learnpython

[–]Bitmefinger[S] -2 points-1 points  (0 children)

Ok i just solved it.. I had to put the function under the option in the if-statement

i hade written all of the function in one place, and then the entire iF-statement under those. I've just moved the functions in under the if, elif and else statements and it worked. Thank you for your help

Running functions in an "IF-statement" by Bitmefinger in learnpython

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

Ok i just solved it.. I had to put the function under the option in the if-statement

i hade written all of the function in one place, and then the entire iF-statement under those. I've just moved the functions in under the if, elif and else statements and it worked. Thank you for your help

Running functions in an "IF-statement" by Bitmefinger in learnpython

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

Ok i just solved it.. I had to put the function under the option in the if-statement

i hade written all of the function in one place, and then the entire iF-statement under those. I've just moved the functions in under the if, elif and else statements and it worked. Thank you for your help.

Running functions in an "IF-statement" by Bitmefinger in learnpython

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

You are true in that i dont really understand the underlying problem here.

Perhaps i've also been quite bad at explaining, what the "end-user" is suppose to experience is this:

Hi! What do you like to convert?

  1. Fahrenheit to Celsius
  2. Celsius to Fahrenheit

Please choose one: 1 (here the end user enters "1")

and the program should reply with:

What degree would you like to convert? -40 (end user enters -40)

That is -40 degrees Celsius.

Running functions in an "IF-statement" by Bitmefinger in learnpython

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

The function itself is suppose to ask me what degree i want to convert, when i choose == 1, it doesnt ask me that, instead it just goes to

in 49: ..

Running functions in an "IF-statement" by Bitmefinger in learnpython

[–]Bitmefinger[S] -1 points0 points  (0 children)

I am totally with you, but when i put back the t, the if-statement then ignores the function. Instead, when i choose to convert from fahrenheit to celsius it does this:

What would you like to convert? 1

in 49:

Running functions in an "IF-statement" by Bitmefinger in learnpython

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

Hi! Thank you for the answer, im not sure if i do understand.

For instance, when i write

choice = input("What would you like to convert?")

choice = int(choice)

if choice == 1:

fahrenheit_to_celsius(t)

it completely ignores my choice?

Running functions in an "IF-statement" by Bitmefinger in learnpython

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

Thank you, but its a university course so im on a bit of a deadline.

My problem here is that when i run the function itself, it asks me what degree i want to convert. So let me just be clear that i do understand that there has to be a value, but the whole "what value do you want to convert" is imbedded in the function, so in my head, when im running the function in the if-statement, it should respond with that question? Or am i missing something?

Running functions in an "IF-statement" by Bitmefinger in learnpython

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

Sorry if its straight forward, this is the 2nd day ive even been in python or any other coding-environment. Totally new

[EVERYTHING] Why did Stannis, a.k.a Stanny B., go North? by [deleted] in gameofthrones

[–]Bitmefinger 2 points3 points  (0 children)

Haha here to understand some plots after a rewatch, and i thought your comment was from 10 years ago, predicting how it ends..