Neuer Kurs! Jeder Programmierer sollte generative KI lernen!
Kostenlose Lektion ausprobieren0
My code does not run in the code editor provided by the platform but equally runs on my PC.
user_information = open("user_info.txt", "a") name = input("Please enter your full name: ") age = input ("Please enter you age: ") location = input("Please enter your location in detailed: ") user_temperature = str(input("Please enter your temperature: ")) user_info1 = (name, age, location, user_temperature) user_information.write("\nuser_name = " + name + "\n" "\nUser age = " + age + "\n" "\nUser location = " + location + "\n" "\nUser temperature = " + user_temperature + "\n") user_information.close() if user_temperature >= "39": print("You must be quarantined.") else: print("You are free to practice social distancing.")
17 Antworten
+ 8
Steven M The lines 13 through 16 don't print but yes it does work as you said...
The one thing I would look at as far as using split() is if Victor Dickson wants to narrow it down to first name verses full name
https://code.sololearn.com/ctCajhCXkTrI/?ref=app
+ 7
Victor Dickson in this second example I just changed one line user_information.write to print
same good results as Steven M mentioned:
https://code.sololearn.com/c0aKkiBHBypN/?ref=app
+ 6
Using the above I stripped away the file and ran the bare code Victor Dickson
and here is a screenshot of needing to be quarantined
https://ibb.co/GW8cz1w
+ 5
Victor Dickson here is a screenshot shot of my results
https://ibb.co/C1yxKP8
+ 3
Victor Dickson inorder to run it here a few lines had to be taken out and the user_information.write became print instead.
https://code.sololearn.com/c29hAaXAb6ST/?ref=app
+ 2
This code runs just fine, I think it is how you are inputting the data. Have you tried putting your inputs on different lines within the Playground? For example:
"Seems like your program requires input:"
Steven
199
somewhere
45
Returns:
"You must be quarantined."
+ 2
Steven M I do run it on all platforms apart from this one.
+ 1
No it actually does not give me the chance to make an input.
+ 1
Please what do you input when they say "split multiple input into separate lines"
+ 1
BroFar it still doesn't work
+ 1
BroFar I wish I could send you a shot of the error
+ 1
Steven M please did you try to make an input? Did it work?
+ 1
BroFar Please how where you able to run it?
+ 1
I made no changes to your code, it runs fine in VSCode, Jupyter and Sololearns Playground
0
I have tried my local machine and now my phone... it works
https://ibb.co/rZ4Tgcp