Created
January 22, 2025 12:02
-
-
Save Denkotleta221/465c2579e400837a9e2abb365c3adbed to your computer and use it in GitHub Desktop.
This file contains hidden or 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 | |
# 1) Task | |
# list = [1, 2, 3, 4, 5] | |
# list.reverse() | |
# print(list) | |
# 2) Task | |
# list_num = [] | |
# for x in range(1, 21): | |
# num = random.randint(1, 100) | |
# list_num.append(num) | |
# even_index = [list_num[i] for i in range(0, len(list_num), 2)] | |
# print(list_num) | |
# print(even_index) | |
# 3) Task | |
# user_num = int(input("Enter number to 100: ")) | |
# num_list = [] | |
# for i in range(1, 101): | |
# x = random.randint(1, 100) | |
# num_list.append(x) | |
# count = 0 | |
# for i in num_list: | |
# if i == user_num: | |
# count += 1 | |
# print(f"Number {user_num}, appered in the list {count} times") | |
# 4) Task | |
# list_num = [] | |
# for i in range(1, 201): | |
# x = random.randint(1, 200) | |
# list_num.append(x) | |
# one_numns = 0 | |
# two_numns = 0 | |
# tree_numns = 0 | |
# for i in list_num: | |
# if i <= 9: | |
# one_numns += 1 | |
# elif i > 9 and i < 100: | |
# two_numns += 1 | |
# elif i > 99: | |
# tree_numns += 1 | |
# print(f"SIngle digits numbers: {one_numns}\nTwo digit numbers: {two_numns}\nThirs digit numbers: {tree_numns}") | |
# 5)Task | |
# m = random.randint(1, 100) | |
# n = random.randint(1, 100) | |
# m_list = [] | |
# n_list = [] | |
# for i in range(1, m): | |
# x = random.randint(1, 100) | |
# m_list.append(x) | |
# for i in range(1, n): | |
# x = random.randint(1, 100) | |
# n_list.append(x) | |
# doble_list = [] | |
# count = 0 | |
# if len(m_list) > len(n_list): | |
# count = len(n_list) | |
# else: | |
# count = len(m_list) | |
# for i in m_list: | |
# for x in n_list: | |
# if i not in doble_list or x not in doble_list: | |
# if i == x: | |
# doble_list.append(i) | |
# print(doble_list) | |
# 6) Task | |
# lucky_tiket = [] | |
# for i in range(1, 6): | |
# x = random.randint(1, 42) | |
# lucky_tiket.append(x) | |
# user_num_1 = int(input("Enter your first number: ")) | |
# user_num_2 = int(input("Enter your second number: ")) | |
# user_num_3 = int(input("Enter your third number: ")) | |
# user_num_4 = int(input("Enter your 4 number: ")) | |
# user_num_5 = int(input("Enter your 5 number: ")) | |
# user_nums = [user_num_1, user_num_2, user_num_3, user_num_4, user_num_5] | |
# count = 0 | |
# for use in user_nums: | |
# if use in lucky_tiket: | |
# count += 1 | |
# print(lucky_tiket) | |
# if count == 3: | |
# print("You are winner 100$") | |
# elif count == 4: | |
# print("You are winner 1000$") | |
# elif count == 5: | |
# print("You are winner 2500$") | |
# else: | |
# print("XXXXXXXXXXXXXX") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment