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 turtle | |
colors = ["#FF9933", "white", "green"] | |
t = turtle.Pen() | |
turtle.bgcolor("black") | |
for i in range(200): | |
t.speed("fastest") | |
t.pencolor(colors[i%3]) |
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 turtle | |
colors = ["green", "white", "red"] | |
t = turtle.Pen() | |
turtle.bgcolor("black") # Set the background color to black | |
for i in range(200): | |
t.speed('fastest') | |
t.pencolor(colors[i % 3]) |
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
text = "PYTHON" | |
print(f"{text}") | |
print(f"{text:#<20}") | |
print(f"{text:_>20}") | |
print(f"{text:.^20}") |
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
from turtle import * | |
import random | |
speed(speed ='fastest') | |
def draw(n, x, angle): | |
# loop for number of stars | |
for i in range(n): | |
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 turtle | |
#initialize method | |
bat = turtle.Turtle() | |
#size of pointer and pen | |
bat.turtlesize(1, 1, 1) | |
bat.pensize(3) | |
#screen info |
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
word = "welcome To minute coder" | |
l = word.split() | |
m = [] | |
for i in l: | |
a = i.capitalize() | |
m.append(a) | |
print(' '.join(m)) | |
# print(word.title()) |
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
num1 = 3_000_000_00 | |
num2 = 3_0 | |
result = num1*num2 | |
print(result) | |
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
# discard function | |
s = {1,2,3} | |
# s_rem = s.remove(4) - throws error | |
s_rem = s.discard(4) # works fine | |
print(s) |
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
# zip in python | |
# zip function takes in multiple iterables and combines them to form a single iterable object. Let's understand its use case | |
# 2 iterables | |
a = [1,2,3] | |
b = ["one", "two", "three"] | |
# use normal - error | |
''' |
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
# write a palindrome program in python | |
# string jise left-> right , right-> left read kro , dono same honge : dad , mom | |
# user input() | |
s = input() | |
# string reverse | |
rev_s = s[::-1] |
NewerOlder