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
# Write a Python program that accepts the name of a student, matric number, course code and the score he/she got in the course. E.g | |
# Name: John Alfred | |
# Matric. No.: MUC/CS/014/0882 | |
# Course Code: CMP 212 | |
# Score: 100 | |
# The program then print the result as: | |
# John Alfred, MUC/CS/014/0882, CMP 212, Grade A | |
# [/left] | |
# [left] |
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
userInput = input('Enter a sentence: ') | |
output = '' | |
for c in userInput: | |
if c==' ': | |
output = output + '_' | |
continue | |
output = output + c |
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
url = "https://www.makeuseof.com/tag/browser-text-based-games/" | |
fullStopIndex = url.find('.') | |
forwardSlashIndex = url[fullStopIndex:].find('/') | |
domain = url[fullStopIndex + 1:fullStopIndex + forwardSlashIndex] | |
print(domain) |