Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Class Homework
#1
Hey all. Python Newbie here. Taking CEIS 100 at DeVry and this weeks Lab has me stumped. We are to write a script the prints out the following:
Who are you and where are you from
What is your name? Frank
Which city do you live in? Hinesville, GA
What is the temperature? 50
It is cold where you live
Frank
You live in:
(city you imputed above).
I got the code for all of it except the last line. How do I get it to print the city I input? code and Traceback I got is :
print("Who are you and where are you from")
name = input("What is your name? ")
city = input("Which city do you live in? ")
temperature = float(input("What is the temperature? "))
if temperature>=60:
print("It is nice where you live.")
if temperature<=59:
print("It is cold where you live")
print(name)
print("You live in:")
print(city=input)

Traceback:
Traceback (most recent call last):
File "C:/Users/Frank/Desktop/DeVry/CEIS 100/Week 4/Who and Where2.py", line 11, in <module>
print(city=input)
TypeError: 'city' is an invalid keyword argument for this function
Huh Huh Huh Huh

Any help is appreciated.
Thanks,
Frank
Reply
#2
 print(name)

vs

 print(city=input)

See the difference?

In the future please post all code, errors (in their entirety) and output between their respective tags. See BBCode for instructions.
If it ain't broke, I just haven't gotten to it yet.
OS: Windows 10, openSuse 42.3, freeBSD 11, Raspian "Stretch"
Python 3.6.5, IDE: PyCharm 2018 Community Edition
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  class homework mohan10216 2 1,743 Oct-28-2020, 06:28 PM
Last Post: jefsummers

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020