Skip to content

Instantly share code, notes, and snippets.

@jnikolak
Created October 26, 2016 13:50
Show Gist options
  • Save jnikolak/f7a3a480dd1cb301c659101a5d634443 to your computer and use it in GitHub Desktop.
Save jnikolak/f7a3a480dd1cb301c659101a5d634443 to your computer and use it in GitHub Desktop.
#**************************************************************
# Version 0.3"
# Author: Jon Nikolakakis with assistance from Jamie Bainbridge
#**************************************************************
import time
correct = 0 # starting value as no values yet correct
index = 0 # starting the index at 0
# answers to all of the questions in array [0 to 8]
answers = ['false','d','mkdir','mount','d','c','b','a','d','a','a','ntp','fqdn','c']
questions = [
"True or False, Can you install Satellite without an existing Rhel/Centos/Fedora?",
"What is the file starts the satellite installation\na) install.sh\nb) setup.py\nc) setup.pl\nd) install.pl",
"In Linux console, what is the command to make a directory i.e _____ /media/cdrom",
"In Linux console, What is the command to load an image. i.e _____ -o loop iso_filename /media/cdrom",
"What ports need to be enabled for the Satellite to connect to the RHN Network?\na) 80\nb) 443\nc) 80 8080\nd) 80 443",
"What satellite server is the latest? \na) 5.7\nb) 6.3\nc) 5.6\nd) 5.5",
"Where is the default location that channels are stored into: \na)/etc/satellite\nb) /var/satellite\nc) /home/satellite\nd) /satellite/channels",
"What install parameter do you add, to install Satellite without an internet connection? \na) --disconnected\nb) --offline\nc) -d\nd) -o",
"If reinstalling Satellite, what parameter do you add, to install Satellite without the database?\na) -c\nb) --clear-database\nc) -no-database\nd) --clear-db",
"What do you require when installing satellite without a configuration \na) Answer File\nb) Start Up script\nc) Configuration file\nd) Setup Script",
"What process on the satellite server is responsible for allowing connections \na) jabberd\nb) osad\nc) Cobbler\nd) Taskomatic",
"Fill in the blanks, The _ _ _ protocol is used to synchronise the time. ",
"Type in the abbreviation for Fully Qualified Domain Name? ",
"What port need to be enabled to allow connection to the RHN Proxy? \na) 80\nb) 443\nc) 5269\nd) 4545",
"What is the recommended minimum amout of space in gigs, \nthat is required to install Satellite? "]
tq = 15 # 14 questions in array + 1 extra
# This functions prints correct and adds 1 to total correct scores
def correctAns():
print "\ncorrect"
global correct
correct+=1
def specq():
global correct
print questions[14] # print question position 14 from the array
try:
guess1 = raw_input("Type in a number? ")
guess1 = int(guess1)
if guess1 >=30: # if greater than or equal to 30
print "\nCorrect, Its recommended to have at least 30 gigs space"
correct+=1
else:
print "\nIncorrect, Satellite requires minimum 30gig of space"
except ValueError, TypeError:
print "\nIncorrect, must be a number"
print "\n"
print "Welcome to Satellite Installation Quiz this",tq, "question quiz is designed to"
print 'test your knowledge on installing satellite, results will be calculated'
print "at the end of the script, your result wont be wont be recorded, good luck!\n"
print specq() # can't add this question to array as using try and except.
for q in range(14): # for condition that reaches 14 times
print questions[index] # print questsions starting from index position
guess2 = str.lower(raw_input()) #guess2 = user input
if guess2 == answers[index]: #if the guess2 equals the answer from index position
correctAns() # call the function correctAns
else:
print (guess2, 'is incorrect') # else, print incorrect with the guess made
index += 1 # add one to the index to go to the next
print "\n"
total = float((correct * 100) / tq) # formula to get percentage
print "Total answers correct =",correct
print "That gives you a score of",total,'%'
if correct <=3:
print "\nFAILED....Please study the Satellite Installation manual more"
if correct >=4 and correct <=9: # greater or equal than 5 and equal or less than 9
print "\nFAILED....Not bad, but you need to do more reading"
if correct >=10 and correct <=14: # greater or equal than 10 and equal or less than 14
print "\nPASSED....Great, try again to get 100%"
elif correct ==15:
print "\nPASSED....Perfect Score!, you know Satellite installation well!"
time.sleep(5)
# ********* 0.2 CHANGE LOG **********
# - Adjusted variable from guesses to include str and lower in same line
# - Added more question
# - Corrected few questions and answers to make more sense.
# - Added changelog and comments
# - Changed question 3 and 4 error detection to use isupper from == to 'answers[]'
# ********* 0.3 CHANGE LOG **********
# - Added function for correct answer and adjusted correct = correct + 1 to correct+=1
# - In Function count added global paramater.
# - Added questions and answers into array
# - questions are now looping through the array which starts from [index] variable
# - made question 14 a function specq to call.
# ***********************************
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment