repl.it
@StanleyBlack/

iteration 2

Python

No description

fork
loading
Files
  • main.py
  • main2.py
  • main3.py
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# imports os
import os 
# imports time
import time
# sets the clear function
clear = lambda: os.system('clear')
clear()
# makes it a loop
Running = True
while Running:
 # it will wait untill the user has entered the input
 print("~~~~~~~~~~~~~~~~~")
 print("Please select one of the following options:")
 print()
 print("Enter '1' to play:")
 print("Enter '2' to Register:")
 print("Enter '3' to Exit:")
 print()
 selection=input()
 # gets user input
 if selection == "3":
   Running = False
   print("Sorry you are leaving. Have a nice day!")
 elif selection == "1":
   #  to split what the user has inputed
   print()
   print()
   import main3
   main3.mainw()
   
 elif selection == "2":
   #  to split the user into what it wants
    print("2 selected")
    import sys
    name = input(
    "please enter your first name: ")  #this imputs first and second name
    surname = input("please enter your surname: ")
    name = name.upper()  #uppercases the first name
    surname1 = surname.upper() #uppercases the second name
    initial = name[:1] #outputs uppercased first name initial #holds initial as uppercase 
    initial1 = surname1[-1] #outputs uppercased first name initial
    initial2 = surname1[:1]
    sys.stdout.write(initial + initial2 + initial1) #prints the initial and surname together

 else:
   print("ERROR!!!!")
   print("You did not enter a correct option.")
   print("Please try again.")
   
   #prints empty line
   print()
   # make the code execute wait 
   time.sleep(2.5)
   # uses clear function
   clear()