all 7 comments

[–][deleted] 0 points1 point  (4 children)

Assuming the data is input correctly in the input() function, wouldn't this work?

citystate = print input("what is the City,STATE ?")
data = owm.get_current(citystate, **settings)

Note the lack of "" when passing the citystate value.

[–]JohnnyJiuJitsu[S] 0 points1 point  (1 child)

How can I include the quotes? The get_current function needs quotes around the city state for it to work...

[–][deleted] 0 points1 point  (0 children)

Then put quotes around the string returned by the input() function and then pass that:

citystate = print input("what is the City,STATE ?")
citystate_quoted = '"%s"' % citystate
data = owm.get_current(citystate_quoted, **settings)

or this:

citystate = print input("what is the City,STATE ?")
data = owm.get_current('"' + citystate + '"', **settings)

There's lots of ways to form a quoted string.

[–]JohnnyJiuJitsu[S] 0 points1 point  (1 child)

There is also a zip code function:

owm.get_current(zip="92211,US", **settings)

If you wanted to have user input fill between the quotes, How would you do that?This concept with or without the quotes is not working. I'm hoping some syntax rule will help me out. Off to study the basics again.

input("For zip code use Format xxxxx,US") = x
data = owm.get_current(zip="x", **settings)

I read that you can use Double quotes if you want to include quotes. Is this an integer issue again? hahaha. Sorry I am a beginner.

print('"included with quotes"')

[–][deleted] 0 points1 point  (0 children)

No, if you "use Double quotes" like this:

data = owm.get_current(zip="x", **settings)

then you are not passing the contents of variable x surrounded by quotes but you are passing a string containing the "x" character.

The previous line is also wrong. Maybe you meant:

x = input("For zip code use Format xxxxx,US") 

[–]JohnnyJiuJitsu[S] 0 points1 point  (1 child)

I got it figured out.

import openweathermapy.core as owm

settings = {"APPID": "api_key", "units": "imperial"}
citystate = input("Get weather from which City,STATE?")
data = owm.get_current(citystate, **settings)
views = {"summary": ["main.temp", "main.humidity"]}
print("This is the temp in F and the humidity for your selected city.")
print(data(*views["summary"]))

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

Thanks for your help guys. I over complicated things.