pattern | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

pattern

how Fill in the blanks to create a pattern that matches strings that contain 3 characters, out of which the last character is an exclamation mark r"

quot;

17th Jun 2017, 10:33 PM
ELMOUIAH OUSSAMA
ELMOUIAH OUSSAMA - avatar
6 Answers
+ 7
import string import random strlist=list(string.printable) new=[] for c in range(0,2): new.append(random.choice(strlist)) new.append("!") print("".join(new))
17th Jun 2017, 11:18 PM
Ahri Fox
Ahri Fox - avatar
+ 6
@NulledNVoid it does, that's what string.printable is for!
17th Jun 2017, 11:24 PM
Ahri Fox
Ahri Fox - avatar
+ 2
like go! Hi! ?
17th Jun 2017, 11:08 PM
NulledNVoided
NulledNVoided - avatar
+ 2
@Ahri Ok i thought so was not sure.
17th Jun 2017, 11:27 PM
NulledNVoided
NulledNVoided - avatar
+ 2
And srry nvm ahri's code is what you are looking for
17th Jun 2017, 11:32 PM
NulledNVoided
NulledNVoided - avatar
+ 1
Well that should do it. However you need some kind of list or input to choose from so that it appends.
17th Jun 2017, 11:20 PM
NulledNVoided
NulledNVoided - avatar