Home Input and Print
Reply: 3

Input and Print

Alzz_HD
1#
Alzz_HD Published in 2017-11-14 20:37:50Z

I am trying to get a input to be typed after the "Choice: " but i also want to continue "*" around the whole text... Im not sure how to do it even after trying multiple times with variations and research i couldn't dind an answer...

print("  ********School Quizes********  ")
print("  *                           *  ")
print("  *       A) Register         *  ")
print("  *       B) Loging           *  ")
print("  *       C) Quit             *  ")
print("  *                           *  ")
input("  *                Choice: ") & print(" *  ")

so that it is printed with "Choice:(here will be the input) * "

wwii
2#
wwii Reply to 2017-11-14 20:58:25Z

Use string formatting - Format Specification Mini Language

fmt = "  *{: ^27}*  "
print(fmt.format('Choice: foo'))

>>>   
  *        Choice: foo        *  
>>>   
Chun-Yen Wang
3#
Chun-Yen Wang Reply to 2017-11-14 21:27:31Z

I can do it this way. But I feel this is really a hack...

x = input('''
  ********School Quizes********  
  *                           *  
  *       A) Register         *  
  *       B) Loging           *  
  *       C) Quit             *  
  *                           *  
                              *\r  *             Choice:    ''')
Brian Ton
4#
Brian Ton Reply to 2017-11-15 01:57:25Z

Technically, you could just do this:

print("  ********School Quizes********  ")
print("  *                           *  ")
print("  *       A) Register         *  ")
print("  *       B) Loging           *  ")
print("  *       C) Quit             *  ")
print("  *                           *  ")
input("  *       Choice:             *  ")

All the text in the quotation marks do is that it just acts as text to be prompted, which is why this works.

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.333931 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO