+ 4
How can i put a space between 2 words in "If statements"?
17 odpowiedzi
+ 4
I THINK THIS WOULD HELP YOU.
age = int(input())
name = input()
if age >= 18:
print('Welcome ' + name)
else:
print('Sorry')
+ 2
Press spacebar 🙂....sorry i can't understand the question
+ 1
You can concatenate strings with +, so you just can add a string with a blank space to it. Re-read the lesson, there are examples
It is unclear to me how this question is related to if-statements.
+ 1
Did you solve it?
If you still need help, please link your code.
+ 1
After 'Welcome' you need to put the blank space, e.g. 'Welcome '. Or replace the '+' by a ','
+ 1
IT BASICALLY CHECKS IF THE PERSON IS 18+ AND WELCOMES HIM.
+ 1
name=input ("enter your name:")
age=int(input("enter your age:")
if age >18:
Print("welcome" + name)
else:
Print("Sorry")
OR
name=input()
age=int(input())
if age >18:
Print("welcome" + name)
else:
Print("Sorry")
0
I don't understand the question. Can you please give an example?
0
The expected output is "Welcome" plus the name of the person, But I don't know how to put space between these two.
0
It is one of the practices of Python Core. The given problem is this:
Write a program to control entrance to a club.
Only people who are 18 or older are allowed to enter the club.
The given program takes the age and the name of the person who tries to enter. Complete the program to output "Welcome" followed by the name of the person if they are allowed to enter the club, and "Sorry" if they are younger than the allowed age.
Sample Input
24
James
Sample Output
Welcome James
0
i don't really get this question
maybe type an "and"?
example:
if bot == pizza and user == hot dog
print()
0
age = int(input())
name = input()
if age >= 18:
print('Welcome' +name)
else:
print('Sorry')
0
Solved. Thanks.
0
https://code.sololearn.com/cnaIbzt6cMNg/?ref=app
Each line of code is explained as well as how to put a space between the words.
0
As far as I can understand, you asked this......
print("hi!", end=" ")
print("Hani")
0
The best way I can imagine would be to go with:
name = 'James'
Print(f"Welcome {name}")
That's assuming the use of Python3
0
I THINK THIS WOULD HELP YOU.
age = int(input())
name = input()
if age >= 18:
print('Welcome ' + name)
else:
print('Sorry')