I need help


#1

I need help to write my very first python program to cover this conversation bellow.
‘What is your name?’
“Cisse”
‘Thanks, Josh. What is your favorite color?’
“Blue-Green”
‘Mine is white. Do you like Burger?’
“yes”
‘Cisse, how old are you?’
“39”
‘… and how many brothers and sisters do you have?’’
“5”
‘That means you are one of 6 children. Is Blue-Green the favorite color of anyone else in your house?’

Strings and Console Output


#2

I’m trying to understand your question here? Are you just trying to figure out how you would go about writing a program that outputs what you wrote above?


#3

Yes, That’s exactly what I am trying to do.
I thought I understood the process but I don’t get the result expected from the interactive console.


#4

well, to write something to the console, in python you use the print('') statement.

for example, your first line would look something like:

print('What is your name?')

unless you are wanting a user of your program to dynamically interact with this, then you would write something up along the lines of:

user_name = raw_input('Enter your name: ')

raw_input() does basically the same thing as print(), the difference is that with raw_input() you can allow the user to type something themselves!


#5

what code do you have so far? What step are you struggling with and would you like that we explain to you?


#6

Here is the first one I did with different content but similar dialog.

# This program says hello and asks for my name.

print('Hello world!')
print('What is your name?')     # ask for their name
myName = input()
print('It is good to meet you, ' + myName)
print('The length of your name is:')
print(Len(myName))
print('What is your age?')  # ask for their age
myAge = input()
print('You sill be '+ str(int(myAge) + 1) + 'in a year.')

#7

What problems you run into? Given you have a different dialog, we have no idea what it is you want. I see an error, function names are case sensitive so it should be len(), but for the rest, please ask specific questions so we can help you where you need it


#8

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.