Python Forum

Full Version: Problem with a language word problem
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
Can anyone solve this problem?
english = "hello"
spanish = "hola"

1

print("hello is hola in Spanish")

2

​

3

print ("goodbye is adios in Spanish")
What's the problem?

Both of your threads lack details. Do you have a homework prompt that can help us to help you?
(May-25-2018, 09:26 PM)micseydel Wrote: [ -> ]What's the problem? Both of your threads lack details. Do you have a homework prompt that can help us to help you?
1. The problem is that using English to Spanish translations, make at least 2 correct translations.
2. I don't have anything that might help solve the problem.
I'm guessing that you are supposed to fill in another Spanish word for hello under 2, and then add 4 and another word for goodbye/
Is that correct?
what have you tried so far? (show your code)
(May-26-2018, 01:27 PM)Larz60+ Wrote: [ -> ]I'm guessing that you are supposed to fill in another Spanish word for hello under 2, and then add 4 and another word for goodbye/
Is that correct?
what have you tried so far? (show your code)
No, your suggestion wasn't correct.


2

Print translations

Given an english string and its spanish translation, print sentences of the form "english is spanish in Spanish"

english = "hello"
spanish = "hola"

1

print("hello is hola in Spanish")

2

english = "goodbye"

3

spanish = "adios"

4

print ("goodbye is adios in Spanish")

Expected output
hello is hola in Spanish
​
 
3
 
print ("goodbye is adios in Spanish")
Expected output
hello is hola in Spanish



3
Well, the code is there, all you have to do is remove the non python lines
use variable names like en_hello, sp1_hello, sp2_hello
and formatted print statements like (for example):
en_tobacco = 'tobacco'
sp1_tobacco = 'tabaco'
sp2_tobacco = 'cigarrillo'

print('{} is {} in Spanish but could also be {}'.format(en_tobacco, sp1_tobacco, sp2_tobacco))
(May-27-2018, 12:55 AM)Larz60+ Wrote: [ -> ]Well, the code is there, all you have to do is remove the non python lines use variable names like en_hello, sp1_hello, sp2_hello and formatted print statements like (for example):
 en_tobacco = 'tobacco' sp1_tobacco = 'tabaco' sp2_tobacco = 'cigarrillo' print('{} is {} in Spanish but could also be {}'.format(en_tobacco, sp1_tobacco, sp2_tobacco)) 
Your suggestion didn't work.
there are not all on the same line!
you must separate!
Then it will work fine.
(May-27-2018, 02:19 PM)Larz60+ Wrote: [ -> ]there are not all on the same line! you must separate! Then it will work fine.
Still no luck.
you are running python interpreter correct?
from command line, type python followed by enter
you should see:
Output:
Python 3.6.5 (v3.6.5:f59c0932b4, Mar 28 2018, 17:00:18) [MSC v.1900 64 bit (AMD6 4)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>>
or something very similar
at >>> prompt type the code one line at a time
paste your output
Pages: 1 2