Skip to content

Instantly share code, notes, and snippets.

View narainravi24's full-sized avatar

Ravi Narain narainravi24

View GitHub Profile
# Write a function named collatz() that has one parameter named number. If number is odd or even
#number is even, then collatz() should print number // 2 and return this value.
#If number is odd, then collatz() should print and return 3 * number + 1.
# First example def of collatz()
def collatz( number ):
if number % 2 == 0:
return " it is even number "
else:
return "it is an odd number"
@narainravi24
narainravi24 / MIT - Exercise
Created July 29, 2019 05:51 — forked from CavaTrendy/MIT - Exercise
MIT - Exercise
#### MIT SOLUTION###
#Write a program that counts up the number of vowels contained in the string s. Valid vowels are: 'a', 'e', 'i', 'o'
#'u'. For example, if s = 'azcbobobegghakl', your program should print: Number of vowels: 5
s = 'azcbobobegghakl'
count = 0
for i in range(0, len(s)):
if s[i] == 'a'or s[i] == 'e'or s[i] == 'i'or s[i] == 'o'or s[i] == 'u':
count += 1
print("Number of vowels: "+ str(count))
import random
user= input("Which tarot reading do you want 3(input 3) cards or 7(input 7) cards? or Quit ")
### major arcana
major = ['The Magician', 'The High Priestess', 'The Empress', 'The Emperor', 'The Hierophant', 'The Lovers',
'The Chariot', 'The Strength', 'The Hermit', 'The Wheel of Fortune', 'The Justice', 'The Hanged Man',
'The Death', 'The Temperance', 'The Devil', 'The Tower', 'The Star', 'The Moon', 'The Sun',
'The Judgement', 'The World', 'The Fool']
### minor arcana pentacle
minor_pentancles = ['1p', '2p', '3p', '4p', '5p', '6p', '7p', '8p', '9p', '10p', 'Jp', 'Qp', 'Kp']
minor_wands = ['1w', '2w', '3w', '4w', '5w', '6w', '7w', '8w', '9w', '10w', 'Jw', 'Qw', 'Kw']
@narainravi24
narainravi24 / Module 1 Basic 0.py
Created July 29, 2019 05:51 — forked from CavaTrendy/Module 1 Basic 0.py
Introduction to Python - Unit 1 Absolute Beginner
# Task 2 use a print() function with comma separation to combine 2 numbers and 2 strings
print("I'm picking you up at",16, "sharp not at ", 17,"Rember!")
# Task 3 display text describing an address, made from stings and variables of different
street = input ( "What is the name of your street?")
str_number = input ("And the number?")
print ("So it is", street, str_number)
# Task 4[ ] define a variable with a string or numeric value
num_newst = 50
@narainravi24
narainravi24 / Module 1 Fundamentals 0.0
Created July 29, 2019 05:52 — forked from CavaTrendy/Module 1 Fundamentals 0.0
Introduction to Python - Unit 2 Fundamentals
# [ ] review and run example - note the first element is always index = 0
student_name = "Alton"
print(student_name[0], "<-- first character at index 0")
print(student_name[1])
print(student_name[2])
print(student_name[3])
print(student_name[4])
# [ ] review and run example
student_name = "Jin"
'''
Created with the help of Python Jumpstart by Building 10 Apps
'''
import datetime
def print_header():
print("----------------------------------")
print("BIRTHDAY APP")
@narainravi24
narainravi24 / program.py
Created July 29, 2019 05:52 — forked from CavaTrendy/program.py
Weather for the Netherlands
import requests
import bs4
import collections
'''
Created with the help of Python Jumpstart by Building 10 Apps
'''
WeatherReport = collections.namedtuple('WeatherReport',
'cond, temp, scale, loc')
''''
This is the first part where we define teh main function of the program Weather App
@narainravi24
narainravi24 / journal.py
Created July 29, 2019 05:52 — forked from CavaTrendy/journal.py
Writing a Journal
'''
This is the Journal module
created with the help of Python Jumpstart by Building 10 Apps
'''
import os
def load(name):
'''
This method creates and load new journal
*****
*Author: Giorgio Alessandro Motta
*
*****
import datetime
import lxml.html as lh
import pandas as pd
import requests
from selenium import webdriver
@narainravi24
narainravi24 / Web 3 Python - Transaction
Created July 29, 2019 05:53 — forked from CavaTrendy/Web 3 Python - Transaction
How to write transaction on Infuria with data
####
# How to write transaction on Infuria with data by Giorgio Alessandro Motta
####
####
# Import
####
from web3 import Web3
import json