Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
ucl/test.py
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
executable file
57 lines (35 sloc)
726 Bytes
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
#!/usr/bin/env python | |
import sys, random | |
###Useful Codes | |
#Going from 10 to 0 then says ready... | |
for i in range(10,-1,-1): | |
print(i) | |
print("Ready!") | |
###Concantenation | |
a=" ".join(["a","b","c"]) | |
print(a) | |
###Split text | |
b="This is a sentence that is made by me." | |
parts=b.split(" ") | |
for i in parts: | |
print(i) | |
###Lowercase & Uppercase | |
for i in parts: | |
print(i.upper()) | |
print(i.lower()) | |
###Stripping | |
userInput=" Quit " | |
if userInput.strip().lower()=="quit": | |
print("Quitting") | |
else: | |
print("Unknown Command") | |
### | |
print(sys.argv[1]) | |
print(sys.argv[2]) | |
print(sys.argv[2]) | |
###recursion | |
values=[] | |
for i in range(100): | |
values.append(values[-1]+random.radint(0,10)) | |
print(values) | |
###port scanner | |