0
What scripts should I try with python first?
4 Respuestas
+ 1
thank you. I've done the "hello world " getting into a password script possibly soon
0
Well usually there is the hello word script, a really simple program. My first script was like this:
def myFirstFunction():
print("This is my first Python Function!")
myFirstFunction()
and then I began to add other elements in functions and variables, following step by step this course.
For istance I could add something like
def signature(name):
print("And my name is {}".format(name))
signature("Jay")
in order to understand string and variables and so on...
0
If you check in the code section, solo lear profile had made this:
import string
from random import *
letters = string.ascii_letters
digits = string.digits
symbols = string.punctuation
chars = letters + digits + symbols
min_length = 8
max_length = 16
password = "".join(choice(chars) for x in range(randint(min_length, max_length)))
print(password)
it's quite easy, there are some import at the beginning in order to access code written by others and get some useful classes and function, in this case string and random because we want to use the letters, numbers and digits already specified in that libraries. Than thanks to random lib we can use the randint function that allows us to choose randomly a character between all that characters seen before from string lib.
Sorry for the very brief explanation. I hope it could help.
0
I tried to make a Celsius to farenheight converter at first, thn I tried (still working) on a sciemtific calculator .