This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import string | |
def read_file_content(filename): | |
with open(filename, 'r') as f: | |
text = f.read() | |
return text | |
def count_words(): | |
text = read_file_content("./story.txt") | |
words = [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Student: | |
def __init__(self, name: str, age: int, tracks: list, score: float): | |
self.name = name | |
self.age = age | |
self.tracks = tracks | |
self.score = score | |
def change_name(self, name): | |
print(name) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def find_anagram(word, anagram): | |
if sorted(word) == sorted(anagram): | |
print(f"TRUE::: '{word} and {anagram}' are anagrams of each other.") | |
else: | |
print(f"FALSE::: The two strings '{word} and {anagram}' contradict each other.") | |
if __name__ == "__main__": | |
find_anagram("below", "elbow") | |
find_anagram("hello", "check") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import random | |
game_choices = ["R", "P", "S"] | |
print("Let's [R]ock, [P]aper, [S]cissors!!!\n") | |
while True: | |
computer_choice = random.choice(game_choices) | |
player_choice = str(input("Your choice of letter? ")) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<title>Task Title: Introduction to Javascript</title> | |
</head> | |
<body> | |
<script> | |
let name, height, country; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8" /> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | |
<title>Javascript calculator</title> | |
</head> | |
<body> | |
<script> | |
// holds the kind of arithmetic operation to be performed |