Skip to content
Sign UpLog In
This post is read-only. Explore Repls and connect with other creators on Community.View Community
The info in this post might be out of date, check out our docs instead. View docs
1

does anyone know how to make it print a sentence with persons name in it

yomicroyeewww
yomicroyeewww

i want to make it orint a persons name with a sentence in it

2 years ago
You are viewing a single comment. View All
4
Coder100
Coder100

Easy! There are many ways to do this.

1. fstrings

import time print('welcome young fellow replers how are you guys today?') name = input() print(name) time.sleep(1) print(f'it is nice to meet you {name}.')

2. addition

import time print('welcome young fellow replers how are you guys today?') name = input() print(name) time.sleep(1) print(f'it is nice to meet you '+name+'.')

3. Using extra args

import time print('welcome young fellow replers how are you guys today?') name = input() print(name) time.sleep(1) print(f'it is nice to meet you ', name, '.', sep="")

4. String interpolation

Use %s to insert a string, and %d to insert a number.

import time print('welcome young fellow replers how are you guys today?') name = input() print(name) time.sleep(1) print(f'it is nice to meet you %s.' % (name))

5. .format

import time print('welcome young fellow replers how are you guys today?') name = input() print(name) time.sleep(1) print(f'it is nice to meet you {}.'.format(name))
2 years ago