# New in python need help for program

**URL:** <https://discuss.python.org/t/new-in-python-need-help-for-program/21559>\
**Category:** Python Help\
**Created:** [November 30, 2022, 10:57pm UTC](https://discuss.python.org/t/new-in-python-need-help-for-program/21559 "2022-11-30T22:57:23Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Patoloco20](https://avatars.discourse-cdn.com/v4/letter/p/3ec8ea/32.png) [@Patoloco20](https://discuss.python.org/u/Patoloco20)\
**Post date:** [November 30, 2022, 10:57pm UTC](https://discuss.python.org/t/new-in-python-need-help-for-program/21559/1 "2022-11-30T22:57:23Z")

</div>

-displays the phrase: what your continents  
-read continent  
-answer: the continent is:  
“America” if “A” , “European” if “E” , “Asian” if “An”, Africa if “AF”

Thank you for your help  
I need to create this easy program but i know how to do it

---

<div class="post-metadata">

**Author:** ![Quercus](https://sea2.discourse-cdn.com/flex002/user_avatar/discuss.python.org/quercus/32/31483_2.png) [@Quercus](https://discuss.python.org/u/Quercus)\
**Post date:** [November 30, 2022, 11:16pm UTC](https://discuss.python.org/t/new-in-python-need-help-for-program/21559/2 "2022-11-30T23:16:51Z")

</div>

Hello, @Patoloco20, and welcome to Python Software Foundation Discourse!

Is this a homework assignment?

Please let us know what you have already learned about Python programming. Are you familiar with any of the following:

- The `input()` function
- The `print()` function
- `if` - `elif` - `else` conditional statements
- `dictionaries`
- Creating and calling your own Python functions

We hope you enjoy the discussions here. For additional information about this forum, please see:

- [Python Discourse Quick Start](https://discuss.python.org/t/python-discourse-quick-start/116)
- [About Discussions on Python.org](https://discuss.python.org/about)

_EDITED (November 30, 2022) to correct a typographical error._

---

<div class="post-metadata">

**Author:** ![Patoloco20](https://avatars.discourse-cdn.com/v4/letter/p/3ec8ea/32.png) [@Patoloco20](https://discuss.python.org/u/Patoloco20)\
**Post date:** [November 30, 2022, 11:29pm UTC](https://discuss.python.org/t/new-in-python-need-help-for-program/21559/3 "2022-11-30T23:29:19Z")

</div>

Hi a little homework  
Where is what i done

Continents =float (input ("what is your contient A,AF,AN,E ? : ")

AF = AFRICA  
A = AMERICA  
AN = ASIA  
E= EUROPEAN

IF CONTINENTS == AF :  
PRINT("THE CONTINENTS IS AFRICA ")

---

<div class="post-metadata">

**Author:** ![Quercus](https://sea2.discourse-cdn.com/flex002/user_avatar/discuss.python.org/quercus/32/31483_2.png) [@Quercus](https://discuss.python.org/u/Quercus)\
**Post date:** [November 30, 2022, 11:51pm UTC](https://discuss.python.org/t/new-in-python-need-help-for-program/21559/4 "2022-11-30T23:51:20Z")

</div>

When you post Python code, please format it correctly for posting, so that essential details such as indentation, quote marks, and other features are displayed properly. One technique for accomplishing this is to place lines (fences) of three back ticks before and after the code, as follows:

````
```
# This is example code.
print("Hello, World!")
```

````

You also have the option of selecting the code and clicking the `</>` button at the top of the editing window.

Remember that Python is case-sensitive. For example, `PRINT` in the following will not work:

```auto
PRINT("THE CONTINENTS IS AFRICA ")

```

This will work:

```auto
print("THE CONTINENTS IS AFRICA")

```

However, this might produce output that looks better:

```auto
print("The continent is Africa.")

```

For this project, the user’s input should not be converted to a `float`. You are not dealing with numbers here. Your statement for collecting the input should be like this:

```auto
continent = input("what is your continent A,AF,AN,E ? : ")

```

Note that some spelling adjustments have been made in the above.

Remember that in Python, indentation is important. Please consider this example:

```auto
if country == "France":
    print("The capital is Paris.")

```

Please try to complete your code, then post it again, with proper formatting.

---

<div class="post-metadata">

**Author:** ![steven.daprano](https://sea2.discourse-cdn.com/flex002/user_avatar/discuss.python.org/steven.daprano/32/1083_2.png) [@steven.daprano](https://discuss.python.org/u/steven.daprano)\
**Post date:** [November 30, 2022, 2:21pm UTC](https://discuss.python.org/t/new-in-python-need-help-for-program/21559/5 "2022-11-30T14:21:11Z")

</div>

Python is case-sensitive: `PRINT` is not the same as `print`. One of them works, the other will give you an error. Can you work out which one is which?

When you set a variable to a string, like this:

```
AF = AFRICA

```

the string needs to be in quotation marks:

```
AF = "AFRICA"

```

Why are you converting the user’s continent into a float?

```
float(input("what is your contient A,AF,AN,E ? : ")

```

If the user types “AF”, Python will try to turn “AF” into a floating point number like 2.175 or 3.5, and fail with an error.

---

<div class="post-metadata">

**Author:** ![Quercus](https://sea2.discourse-cdn.com/flex002/user_avatar/discuss.python.org/quercus/32/31483_2.png) [@Quercus](https://discuss.python.org/u/Quercus)\
**Post date:** [December 1, 2022, 2:11pm UTC](https://discuss.python.org/t/new-in-python-need-help-for-program/21559/6 "2022-12-01T14:11:59Z")

</div>

@Patoloco20, this won’t work in your program:

```auto
AF = AFRICA
A = AMERICA
AN = ASIA
E= EUROPEAN

```

> [@steven.daprano](#):
>
> the string needs to be in quotation marks:
> 
> ```auto
> AF = "AFRICA"
> 
> ```

In addition to the fact that literal strings need to be delimited by quotation marks, you don’t need to create a separate variable for each continent. If you do the following, the user’s input will be represented by the variable, `continent`, and that is the only variable that you will need:

```auto
continent = input("what is your continent A,AF,AN,E ? : ")

```

But let’s digress a little bit by offering an example below that resembles a solution that will work for you, but differs sufficiently from an actual solution to avoid our doing your homework for you, which would detract from your learning experience.

```auto
city = input("Name a city from my book (Paris or London): ")
if city == "Paris":
    print("I worked in France.")
elif city == "London":
    print("I worked in England.")
else:
    print(city + " is nice, but it wasn't in my book.")

print("Regards, Eric Arthur Blair")

```

In the above, the user enters the name of a city, and that input is checked in the conditional block headers. For your homework, you would be checking, instead, for the various abbreviations for continents that the user is expected to enter.
