+ 4

How can i put a space between 2 words in "If statements"?

28th Apr 2022, 1:52 PM
Hani
Hani - avatar
17 Answers
+ 4
I THINK THIS WOULD HELP YOU. age = int(input()) name = input() if age >= 18: print('Welcome ' + name) else: print('Sorry')
29th Apr 2022, 1:53 PM
AARAV PANDEY
AARAV PANDEY - avatar
+ 2
Press spacebar 🙂....sorry i can't understand the question
30th Apr 2022, 1:26 AM
SHAIK ABDULHAMEED
SHAIK ABDULHAMEED - avatar
+ 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.
28th Apr 2022, 2:12 PM
Lisa
Lisa - avatar
+ 1
Did you solve it? If you still need help, please link your code.
28th Apr 2022, 2:30 PM
Lisa
Lisa - avatar
+ 1
After 'Welcome' you need to put the blank space, e.g. 'Welcome '. Or replace the '+' by a ','
28th Apr 2022, 2:34 PM
Lisa
Lisa - avatar
+ 1
IT BASICALLY CHECKS IF THE PERSON IS 18+ AND WELCOMES HIM.
29th Apr 2022, 1:54 PM
AARAV PANDEY
AARAV PANDEY - avatar
+ 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")
30th Apr 2022, 9:13 AM
Fernweh
0
I don't understand the question. Can you please give an example?
28th Apr 2022, 2:06 PM
Lisa
Lisa - avatar
0
The expected output is "Welcome" plus the name of the person, But I don't know how to put space between these two.
28th Apr 2022, 2:10 PM
Hani
Hani - avatar
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
28th Apr 2022, 2:24 PM
Hani
Hani - avatar
0
i don't really get this question maybe type an "and"? example: if bot == pizza and user == hot dog print()
28th Apr 2022, 2:32 PM
Decode
Decode - avatar
0
age = int(input()) name = input() if age >= 18: print('Welcome' +name) else: print('Sorry')
28th Apr 2022, 2:32 PM
Hani
Hani - avatar
0
Solved. Thanks.
28th Apr 2022, 2:48 PM
Hani
Hani - avatar
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.
28th Apr 2022, 4:07 PM
Ava Alford
0
As far as I can understand, you asked this...... print("hi!", end=" ") print("Hani")
28th Apr 2022, 11:28 PM
Md. Faheem Hossain
Md. Faheem Hossain - avatar
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
29th Apr 2022, 5:45 PM
Iain Ozbolt
Iain Ozbolt - avatar
0
I THINK THIS WOULD HELP YOU. age = int(input()) name = input() if age >= 18: print('Welcome ' + name) else: print('Sorry')
30th Apr 2022, 9:15 AM
Mahesh Chaudhary