python programming projects with source code code example
Example 1: python projects with source code for beginners
from random import randint
print("Hey there! In this game, you will have to guess a random number from 1, 20. Good luck!")
user_name = input("What's your name?\n")
print(user_name,"pick a number!")
guess = input()
random_int = randint(0, 20)
if guess != random_int:
print('That was wrong!', random_int, "was the number!")
else:
print('That was correct!')
Example 2: python projects with source code for beginners
import random
import string
letters = string.ascii_letters
print('Your brand new password is:')
print (''.join(random.choice(letters) for i in range(12)))