I am new to phyton
All of us have been new once, it is not sin. Just take one step at time and test your code.
for the quiz i want
number of questions to ask
number of questioned asked so far
can you help me out? im confused
Good luck! We can help anybody who shows proper effort and posts spesific question after proving effort.
well so far i got this
print ("Welcome to my quiz!") begin = (input("would you like to begin?: ")) if begin =="yes": q1 = (input("Is Steve Jobs is the founder of Apple?")) if q1 == "true" or q1 == "True": print ("well done! you got it right!") if q1 == "False" or q1 == "false": print ("wrong, try again") else : print ("Thanks for trying my quiz! Goodbye")
This is how I would fix it (I used beginning lines to get it run also in Python2)
# make input equal to Python3 style input even in Python2 try: input = raw_input except: pass print("Welcome to my quiz!") questions = (("Is Steve Jobs the founder of Apple?", 'yes'), ("Is this stupid program?", 'no')) for q, right in questions: if input(q).lower() == right: print("Well done! You got it right!") else: print("You got it wrong this time!")
Edited 4 Years Ago by pyTony
how do i add number of questions to ask
i want to make sure that people can ask how many question the want to answer in my quiz. how can i do that?
# make input equal to Python3 style input even in Python2 try: input = raw_input except: pass def questions (): global questionlist print =("how many question do you want to answer") while questioncount < 4: print("Welcome to my yes or no quiz!") questions = (("Denis Glover wrote the poem The Magpies ", 'yes'), ("God Save the King was New Zealand’s national anthem up to and including during WWII ", 'yes'), ("Kiri Te Kanawa is a Wellington-born opera singer ", 'no'), ("Phar Lap was a New Zealand born horse who won the Melbourne Cup ", 'yes'), ("Queen Victoria was the reigning monarch of England at the time of the Treaty ", 'yes'), ("Split Enz are a well-known rock group from Australia who became very famous in New Zealand during the 80s ", 'no'), ("Te Rauparaha is credited with intellectual property rights of Kamate! ", 'yes'), ("The All Blacks are New Zealands top rugby team ", 'yes'), ("The Treaty of Waitangi was signed at Parliament ", 'no'), ("The Treaty of Waitangi was signed in 1901 ", 'no'), ("Aotearoa commonly means Land of the Long White Cloud ", 'yes')) for q, right in questions: if input(q).lower() == right: print("Well done! You got it right!") else: print("You got it wrong this time!")
Hey, so I wanna ask how I need to create a method who will remove word if in that word is 2 same chars. Example: "Potato" in this word there is a 2 "o" chars so this word will need to be removed. "Forum" in this word there is no ...
Hi. I have a form with list box : lst_product, datagridview : grd_order and button: btn_addline. lst_product has a list of product ids selected from database (MS Acess 2013) , grd_order is by default empty except for 2 headers and btn_addline adds rows to grd_order.
Private Sub btn_addline_Click(ByVal ...
Hi, as I was told that my code doesn’t scale well at all, I thought perhaps I’d try to get a better understanding of interfaces/abstract classes and classes and the relationship between them.
I don’t want at this stage work on a big separate project as I've already got plenty ...