Final python part B
Final python part B
1. Rationale
Python is powerful programming language. It has efficient high-level data structures and a
simple but effective approach to object-oriented programming. Python code is simple,
short, readable, intuitive, and powerful, and thus it is effective for introducing computing
and problem solving to beginners. It's elegant syntax and dynamic typing, together with its
interpreted nature, make it an ideal language for scripting and rapid application
development in many areas on most platforms.
4. Literature review
What is python?
Python is a high-level, versatile, and dynamically-typed programming language. It was
created by Guido van Rossum and first released in 1991. Python emphasizes readability
and ease of use, and its design philosophy focuses on code readability and ease of
maintenance.
What is If-Else Statement?
In Python, an if statement is used to execute a block of code if a certain condition is true.
The if statement can be extended with an optional else clause, which is executed if the
condition is false. If the condition evaluates to True, the code block under the if statement
is executed. If the condition is False, the code block under the else statement is executed.
What is While Loop?
In Python, a while loop is used to repeatedly execute a block of code as long as a specified
condition evaluates to True. The loop continues to execute as long as the condition remains
true. The condition is evaluated before each iteration of the loop. If the condition is True,
the code block inside the while loop is executed. After each iteration, the condition is
checked again, and if it's still True, the loop continues.
4. Actual Methodology Followed
Alogrithm
Import random
score = 0
rounds = min(5, len(word_list)) # Ensure rounds don't exceed available words
words_used = random.sample(word_list, rounds) # Pick unique words
if guess == word:
print("Correct! You earned 1 point.")
score += 1
else:
print(f"Wrong! The correct word was '{word}'.")
10. Reference:
https://www.w3schools.com/python/python_compiler.asp
https://www.geeksforgeeks.org/python-programming-language-tutorial/